Forum Discussion
w100ewd
9 years agoFrequent Visitor
Bar Chart w/specific % calculation
I'm trying to calculate the overall "In Stock" % for the following. Within excel this would be a simple calculation for me using a COUNTIFS statement, however trying to use Power BI and DAX I'm s...
- 9 years ago
In general, COUNTIF is replaced with CALCULATE in DAX. Something like this:
Measure 4 = CALCULATE(COUNT([Part #]),FILTER(Inventory,Inventory[Stock Out]="N")) / CALCULATE(COUNT([Part #]),ALLEXCEPT(Inventory,Inventory[Inventory Class]))
Make sure the measure is formatted as % in your model.
Greg_Deckler
9 years agoCommunity Champion
In general, COUNTIF is replaced with CALCULATE in DAX. Something like this:
Measure 4 = CALCULATE(COUNT([Part #]),FILTER(Inventory,Inventory[Stock Out]="N")) / CALCULATE(COUNT([Part #]),ALLEXCEPT(Inventory,Inventory[Inventory Class]))
Make sure the measure is formatted as % in your model.
- w100ewd9 years agoFrequent Visitor
This works great when using the formula this morning. It's very different right now, but in time I'm sure I will figure out the new formula types.
Thank you for the help.