cancel
Showing results for
Did you mean:
Helper II

## 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.

 Product No of Machines Biscotti 3 Cream Donut 7 Caramel 3 Chocolate cookies 7 Double Chocolate 3 Chocolate Donut 3 Custard Donut 7 Deluxe Cookies 3

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.

 Product Machine No of Machines Biscotti Jam Machine 3 Biscotti Pressing Machine 3 Biscotti Sprinkling Machine 3 Cream Donut Boxing Machine 7 Cream Donut Filling Machine 7 Cream Donut Forming Machine 7 Cream Donut Heating Machine 7 Cream Donut Mixing Machine 7 Cream Donut Topping Machine 7 Cream Donut Packaging Heat Machine 7 Caramel Jam Machine 3 Caramel Pressing Machine 3 Caramel Sprinkling Machine 3 Chocolate cookies Boxing Machine 7 Chocolate cookies Filling Machine 7 Chocolate cookies Forming Machine 7 Chocolate cookies Heating Machine 7 Chocolate cookies Mixing Machine 7 Chocolate cookies Topping Machine 7 Chocolate cookies Packaging Heat Machine 7 Double Chocolate Jam Machine 3 Double Chocolate Pressing Machine 3 Double Chocolate Sprinkling Machine 3 Chocolate Donut Jam Machine 3 Chocolate Donut Pressing Machine 3 Chocolate Donut Sprinkling Machine 3 Custard Donut Boxing Machine 7 Custard Donut Filling Machine 7 Custard Donut Forming Machine 7 Custard Donut Heating Machine 7 Custard Donut Mixing Machine 7 Custard Donut Topping Machine 7 Custard Donut Packaging Heat Machine 7 Deluxe Cookies Jam Machine 3 Deluxe Cookies Pressing Machine 3 Deluxe Cookies Sprinkling Machine 3

1 ACCEPTED SOLUTION
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:

Dax:

Measure 13 = CALCULATE(COUNTROWS(NumberOfMachines),ALLEXCEPT(NumberOfMachines,NumberOfMachines[Product]))

End result:

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!

Proud to be a Super User!

2 REPLIES 2
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:

Dax:

Measure 13 = CALCULATE(COUNTROWS(NumberOfMachines),ALLEXCEPT(NumberOfMachines,NumberOfMachines[Product]))

End result:

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!

Proud to be a Super User!

Helper II

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.

Announcements

#### The Power BI Community Show

Welcome to the Power BI Community Show! Jeroen ter Heerdt talks about the importance of Data Modeling.

#### Charticulator Design Challenge

Put your data visualization and design skills to the test! This exciting challenge is happening now through June10th!

#### Check it Out!

Watch Session 22 Ted's Dev Camp along with past sessions!