Replicating a power bi calculation using ALLSELECTED

Greetings, I am trying to recreate a calculation in QuickSight that I once had in Power BI. I have my total customers, which are segregated into various levels as shown below. When I take a simple sum of my members, it automatically splits the number by the levels. However, in the third column, the total number of members is constant. I used the given DAX code to achieve this:

Total Members =
VAR Memb = CALCULATE(SUM(fact_customer_last_activity[no_of_members]),ALLSELECTED(fact_customer_last_activity))

RETURN IF(ISBLANK(Memb),0,Memb)

The ALLSELECTED function allowed me to block it from getting divided by the level names. Is there any way I could get this in QS?

Thank You!

Hi @vkedia

Please try sumOver ensures that the sum is computed across all rows (ignoring the level or any filters applied).

Example: (Syntax may differ - replace the fields from your dataset).

sumOver(
    {no_of_members}, 
    [],
    PRE_AGG
)

1 Like

Hi @vkedia

You can use the sumOver function. An example is provided below

Use the article below for further reading

1 Like

Thank you so much! It is working

1 Like