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
Anonymous
Not applicable

Context in dax measure

Hello to all,

I have a problem with my filter. When I filter on a category, I should have only three people concerned. It works well if in my table I use their own fields. The problem is that when I add fields calculated from measurements in my table, the context of the filter disappears.

In the picture, the top table shows the expected result. It works because I did not add my measure. When I add my measure, the filter by category does not work anymore. I imagine that the ALLEXCEPT function can help me but I can't place it in my measure.

1 Cumulative Buyer/Appro STD = if(CALCULATE([Number of purchases],FILTER('NOHA PURCHASES','NOHA PURCHASES'[Buyer (order)]="X"), FILTER('NOHA CFO','NOHA CFO'[Approval WF Standard]="X"))>=1, "CUMULARITY DECREASED", "CLEAR")

If someone knows how to help me I thank him/her greatly.

 

 

image.png

1 ACCEPTED SOLUTION
V-pazhen-msft
Community Support
Community Support

@Anonymous 
You can add the Allexcept() function in the bold part but you should use Filter(All(table), [Category]=MAX([Category]). So try:

 

1 Cumulative Buyer/Appro STD = if(CALCULATE([Number of purchases],FILTER('NOHA PURCHASES','NOHA PURCHASES'[Buyer (order)]="X"), FILTER('NOHA CFO','NOHA CFO'[Approval WF Standard]="X"), Filter(All('Tablename'),[Category]=MAX([Category])))>=1, "CUMULARITY DECREASED", "CLEAR")

 


Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
V-pazhen-msft
Community Support
Community Support

@Anonymous 
You can add the Allexcept() function in the bold part but you should use Filter(All(table), [Category]=MAX([Category]). So try:

 

1 Cumulative Buyer/Appro STD = if(CALCULATE([Number of purchases],FILTER('NOHA PURCHASES','NOHA PURCHASES'[Buyer (order)]="X"), FILTER('NOHA CFO','NOHA CFO'[Approval WF Standard]="X"), Filter(All('Tablename'),[Category]=MAX([Category])))>=1, "CUMULARITY DECREASED", "CLEAR")

 


Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

Did you see that they simplified the behavior of the CALCULATE() command for scenarios like yours?

 

Specifying multiple filter conditions in CALCULATE - SQLBI

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.