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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
nyann4
New Member

Measure filtering correctly my slicer but having trouble to sum

Hello,
I'm trying to create a measure that will filter a slicer depending on others measures :

nyann4_1-1750822421683.png

 

That measure "filter client" will check the value of CA_filter different than 0 and on my value slicer
I have another measure that will count the number of "1" from "filter_client" : 

nyann4_2-1750822825071.png

 


As you can see as result when I'm displaying all of my values on a matrix : 

nyann4_3-1750822897493.png

I have "1" for this 2 clients, and my "CA_filter" measure is also different than 0.
But the count_unique is does not equal "1" in both case.
Both client are displayed but only one is count, that happend in many case but not all the time.

nyann4_4-1750823101414.png

And I can't figure it out since 2 days ^^"
Hope I can find help here !



 

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @nyann4 

 

Measures don't have a row context so adding them to visuals that don't have such like a card may return an incorrect result. If it needs to be evaluated for each distinct client id before being summed up, use SUMX. Try @v-karpurapud 's solution.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

4 REPLIES 4
danextian
Super User
Super User

Hi @nyann4 

 

Measures don't have a row context so adding them to visuals that don't have such like a card may return an incorrect result. If it needs to be evaluated for each distinct client id before being summed up, use SUMX. Try @v-karpurapud 's solution.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Thank's for replying, actually I doesnt have the time to specify it, but I already try a fews methods before posting here. Including a sumx version of my measure.

But I still figure out, trying your method, that the problem was hiding in my data. I was displaying "raison sociale" (name of the company) in my slicer, but using "code client" in my measure. 
I find out that some of the client has multiple code client, so in my matrix, there was an hiding agregation by "raison sociale", that showed a "1" but taking all of the "code client" of each of the "raison sociale" doesnt give the same result.
Anyway my measure is working now, thank you !

v-karpurapud
Community Support
Community Support

Hi @nyann4 


Welcome to the Microsoft Fabric Community Forum.
 

Regarding your issue with the measure, the filter_client measure checks if a client meets certain conditions and returns 1 or 0. While the matrix shows filter_client = 1 for several clients, the count_unique measure sometimes returns a lower count than expected. This happens because DAX measures like filter_client don't always evaluate row by row within a FILTER() function unless set up to do so.

To fix this, try replacing the count_unique measure with one that uses SUMX to go through each unique client and correctly evaluate the [filter_client] measure in the right row context.

Here’s an example:

count_unique =

SUMX (

    VALUES ( 'client_unique'[Code Client] ),

    IF ( [filter_client] = 1, 1, 0 )

)

If this helps, please mark the response as Accepted Solution so it can assist others. Giving Kudos is also appreciated if you found it helpful.


Thank you for being part of Fabric Community Forum.

Regards,
Karpurapu D,
Microsoft Fabric Community Support Team.


rajendraongole1
Super User
Super User

Hi @nyann4  - If your data model allows it, convert filter_client to a calculated column instead of a measure. 

eg: as per snapshot

filter_client_column =
IF (
[Client_Unique (control)] > 'Jours de retard'[Jours de retard value],
IF ( [CA_Filter] <> 0, 1, 0 ),
0
)

 

call the above filter client column in your measure as 'client_unique'[filter_client_column] = 1

suggest , Always prefer columns for filtering logic instead of measure.

 

Hope this helps.

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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