Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago

Visual Filter behaves differently than Measure Filter?

Hello,

I have a measure called "FTE Req 2". When I put it into card visuals and filter those card visuals based on a "type" column ("ACTUAL" and "BUS CAP") I get the expected results: BUS CAP = 103, ACTUAL = 80, as you can see in the first 2 cards of my screenshot.

 

Next I want to write a measure that subtracts ACTUAL 80 from BUS CAP 103 to give me "-23" which should be on the third card, "FTEReqDifference". However it is giving me an unexpected -3.19.

 

Since I can't figure out how to write a measure that takes "FTE Req 2" measure and filters itself to do this calculation (eg "FTEReqDifference = [FTE Req 2], type="ACTUAL" - [FTE Req 2], type = "BUS CAP" ", I have written two separate measures to filter FTE Req 2 by both types.

 

FTEReqACTUAL = CALCULATE([FTE Req 2],'table'[type] = "ACTUAL")
 
FTEReqBUSCAP = CALCULATE([FTE Req 2],'table'[type] = "BUS CAP")
 
FTEReqDifference = [FTEReqACTUAL]-[FTEReqBUSCAP]
 
Unfortunately these do not give me the numbers expected despite being filtered just like the visuals. Actual shows 11.31, BusCAP shows 14.51 which gives me the -3.19 in FTEReqDifference, not my expected -23. Why?

 

Here is the screenshot with the expected values written in red

 

 

2 Replies

  • Anonymous , Try this

     

    FTEReqACTUAL = CALCULATE([FTE Req 2],filter('table', 'table'[type] = "ACTUAL") )

    FTEReqBUSCAP = CALCULATE([FTE Req 2],filter('table','table'[type] = "BUS CAP") )

     

     

    If this does not help
    Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    Please try.

    FTEReqACTUAL = CALCULATE([FTE Req 2],filter(all('table'), 'table'[type] = "ACTUAL") )
    
    FTEReqBUSCAP = CALCULATE([FTE Req 2],filter(all('table'),'table'[type] = "BUS CAP") )
    
    FTEReqDifference = [FTEReqACTUAL]-[FTEReqBUSCAP]

    If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

     

    Best Regards,

    Neeko Tang

    If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly.