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
msantillan
Helper II
Helper II

Total Doesn't seem to apply the filters

Hi can anyone explain why the total is still the same even if I applied a Filter on a measure.

 

The left side is just the column without filters, while the right side is the filtered one. You can see that the negative data is already blank but it still returns the same total:

measure.png

 

Here is the measure I used:

 

Grand Total 2 =
var CLNTNME = FIRSTNONBLANK('Reference December AUM'[CLIENT_NAME],1)
return if(SUM('Reference December AUM'[MKT_VALUE_USD])<0,BLANK(),SUM('Reference December AUM'[MKT_VALUE_USD]))
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

Try like

Grand Total 2 =
var CLNTNME = FIRSTNONBLANK('Reference December AUM'[CLIENT_NAME],1)
return
calculate(SUM('Reference December AUM'[MKT_VALUE_USD]),filter('Reference December AUM','Reference December AUM'[MKT_VALUE_USD])>0))

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

Try like

Grand Total 2 =
var CLNTNME = FIRSTNONBLANK('Reference December AUM'[CLIENT_NAME],1)
return
calculate(SUM('Reference December AUM'[MKT_VALUE_USD]),filter('Reference December AUM','Reference December AUM'[MKT_VALUE_USD])>0))

@all Thank you for the replies, @amitchandak 's solution was the one that worked for me. 

ImkeF
Super User
Super User

 

you need an iterator-function for the (sub) totals to be correct

 

How about this?:

 

Grand Total 2 =
SUMX(
    VALUES('Reference December AUM'[CLIENT_NAME],
    if(CALCULATE(SUM('Reference December AUM'[MKT_VALUE_USD]))<0,
        BLANK(),
        CALCULATE(SUM('Reference December AUM'[MKT_VALUE_USD]))
)

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

az38
Community Champion
Community Champion

Hi @msantillan 

its difficult to answer without full data model nd data example but I guess it could be solved by using CALCULATE() over you SUM() statements, like

Grand Total 2 =
var _calcSum = CALCULATE(SUM('Reference December AUM'[MKT_VALUE_USD]))
return 
if(_calcSum <0,BLANK(),_calcSum )

by the way, why do you use CLNTME in the statement?


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

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.