Forum Discussion

w100ewd's avatar
w100ewd
Frequent Visitor
9 years ago
Solved

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...
  • Greg_Deckler's avatar
    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.