Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Power_It_Up
Frequent Visitor

Selecting a particular value in a filter to return the total of all values

Hi there.

 

Simple table below.  If I filter on Person 'A', I want the SCORECARD to show 185.  Otherwise, show the corresponding Total of the selected Person, i.e. 'B' = 20, 'C' = 30,  and so on.

 

Power_It_Up_0-1711129674811.png

 

Many thanks in advance.

1 ACCEPTED SOLUTION
QuentinBl
Helper I
Helper I

Hello, 
this measure should do the work :

Dax = IF(SELECTEDVALUE('Exemple 2'[Person]) = "A",CALCULATE(SUM('Exemple 2'[total]),ALL('Exemple 2'[Person])),SUM('Exemple 2'[total]))

It can be imporved with a 'switch' instead of a 'if' if you get other tests to do.
QuentinBl_0-1711131137977.png


If you want your total to be corresponding to the new value shown in A, you can switch to this DAX with a SUMX :

Dax = SUMX('Exemple 2', IF('Exemple 2'[Person] = "A",CALCULATE(SUM('Exemple 2'[total]),ALL('Exemple 2')),'Exemple 2'[total]))
QuentinBl_1-1711131601055.png

 



 



View solution in original post

3 REPLIES 3
Power_It_Up
Frequent Visitor

@QuentinBl Many thanks for this example. I shall try it soon. 👍

Hi, @Power_It_Up 

Your solution is great, @QuentinBl . It worked like a charm! Has your current issue been resolved?

 

 

Best Regards

Jianpeng Li

 

 

QuentinBl
Helper I
Helper I

Hello, 
this measure should do the work :

Dax = IF(SELECTEDVALUE('Exemple 2'[Person]) = "A",CALCULATE(SUM('Exemple 2'[total]),ALL('Exemple 2'[Person])),SUM('Exemple 2'[total]))

It can be imporved with a 'switch' instead of a 'if' if you get other tests to do.
QuentinBl_0-1711131137977.png


If you want your total to be corresponding to the new value shown in A, you can switch to this DAX with a SUMX :

Dax = SUMX('Exemple 2', IF('Exemple 2'[Person] = "A",CALCULATE(SUM('Exemple 2'[total]),ALL('Exemple 2')),'Exemple 2'[total]))
QuentinBl_1-1711131601055.png

 



 



Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors