Forum Discussion

ConnieMaldonado's avatar
ConnieMaldonado
Responsive Resident
3 years ago
Solved

CALCULATE Counts with Conditions

Hello!   I have what I think is a simple calculation, but I can't get it to work correctly.   I have a table with SKU items and efficiency rates.  Efficiency rate is the expected duration of the ...
  • jgeddes's avatar
    3 years ago

    You can try three measures (or just one if you want to use variables)

    Success =
    CALCULATE(
        COUNT(efficiencyTable[Item_Name]),
        FILTER(efficiencyTable, NOT(ISBLANK([SKU_Efficiency])) && [SKU_Efficiency] <> 0 && [SKU_Efficiency] >=1)
    )
     
    Total (Non-Zero) =
    CALCULATE(
        COUNT(efficiencyTable[Item_Name]),
        FILTER(efficiencyTable, NOT(ISBLANK([SKU_Efficiency])) && [SKU_Efficiency] <> 0)
    )
     
    Success Rate =
    DIVIDE(
        [Success],
        [Total (Non-Zero)],
        0
    )
     
    I ended up with the following result using your data.