Forum Discussion
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:
| 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 |
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!
2 Replies
- ValtteriNCommunity Champion
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!
- AnonymousNot applicable
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.