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

counting values with conditions using DAX

I feel like this is a very simple questions, but can't seem to get it to work.  I'm trying to do a countif in essence. 

 

I basically want to summarize the number of machines needed to make certain products.

 

ProductNo of Machines
Biscotti3
Cream Donut7
Caramel3
Chocolate cookies7
Double Chocolate3
Chocolate Donut3
Custard Donut7
Deluxe Cookies3

 

I can do that using: 

No of Machines = COUNTROWS('Target Speeds' )
 
However I want to isolate the measure outside of the views context, so I can use it in a DAX formula.
So if I bring machine into the visual I still get the same results.
 
ProductMachineNo of Machines
BiscottiJam Machine3
BiscottiPressing Machine3
BiscottiSprinkling Machine3
Cream DonutBoxing Machine7
Cream DonutFilling Machine7
Cream DonutForming Machine7
Cream DonutHeating Machine7
Cream DonutMixing Machine7
Cream DonutTopping Machine7
Cream DonutPackaging Heat Machine7
CaramelJam Machine3
CaramelPressing Machine3
CaramelSprinkling Machine3
Chocolate cookiesBoxing Machine7
Chocolate cookiesFilling Machine7
Chocolate cookiesForming Machine7
Chocolate cookiesHeating Machine7
Chocolate cookiesMixing Machine7
Chocolate cookiesTopping Machine7
Chocolate cookiesPackaging Heat Machine7
Double ChocolateJam Machine3
Double ChocolatePressing Machine3
Double ChocolateSprinkling Machine3
Chocolate DonutJam Machine3
Chocolate DonutPressing Machine3
Chocolate DonutSprinkling Machine3
Custard DonutBoxing Machine7
Custard DonutFilling Machine7
Custard DonutForming Machine7
Custard DonutHeating Machine7
Custard DonutMixing Machine7
Custard DonutTopping Machine7
Custard DonutPackaging Heat Machine7
Deluxe CookiesJam Machine3
Deluxe CookiesPressing Machine3
Deluxe CookiesSprinkling Machine3
 
 Any advice?
1 ACCEPTED SOLUTION
ValtteriN
Super User
Super User

Hi,

So you want to get the table to ignore every filter context but product? Here is an example on how to do that:

Data:

ValtteriN_0-1642796228074.png


Dax:

Measure 13 = CALCULATE(COUNTROWS(NumberOfMachines),ALLEXCEPT(NumberOfMachines,NumberOfMachines[Product]))
 
End result:
ValtteriN_1-1642796331869.png

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!





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

Proud to be a Super User!




View solution in original post

2 REPLIES 2
ValtteriN
Super User
Super User

Hi,

So you want to get the table to ignore every filter context but product? Here is an example on how to do that:

Data:

ValtteriN_0-1642796228074.png


Dax:

Measure 13 = CALCULATE(COUNTROWS(NumberOfMachines),ALLEXCEPT(NumberOfMachines,NumberOfMachines[Product]))
 
End result:
ValtteriN_1-1642796331869.png

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!





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

Proud to be a Super User!




Anonymous
Not applicable

@ValtteriN 

I think that is going to work.  I will have to check once I get to writing the DAX formula.  Thank you for the help.

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