Forum Discussion

Amos_Lim's avatar
Amos_Lim
Icon for Resolver I rankResolver I
2 years ago
Solved

Measure to Calculate the Defect Rate Not Obtaining the Correct Answer

I created two measures and used them to calculate the failure rate per 100,000 but did not receive the desired result.

 

The first measure was used to calculate the overall number of defects depending on bike number.

Total Defect By Bike No = COUNTROWS(FILTER('Data', 'Data'[Bike] = MAX(Data[Bike])))

 

The second measure was used to compute the defect rate based on 100,000 KM traveled.

Defect Rate per bike = [Total Defect By Bike No] / CALCULATE(SUM(Mileage[Mileage]), ALLEXCEPT(Mileage, Mileage[Bike]))*100000

 

The first measure was correct, but when it came to defect rate per bike, it used the total mileage of all bikes rather to a specific bike number to compute

The logic to the second measure seem correct but I am not sure where goes wrong.

 

Help would appreciate and thank you.

Please find attached the Excel sample file and the pibx file.

 

Sample Files 

 

16 Replies

  • The "ALLEXCEPT" in

    Defect Rate per bike = [Total Defect By Bike No] / CALCULATE(SUM(Mileage[Mileage]), ALLEXCEPT(Mileage, Mileage[Bike]))*100000

    may have summed up all the bikes except the slected bike; how can it be reversed? i.e., only the bike in the slicer was selected to sum up the mileage.

     

      • Ashish_Mathur's avatar
        Ashish_Mathur
        Icon for Super User rankSuper User

        Assuming Total Defect and Total Mileage are measures that you have already written, write this measure

        Measure = divide([Total defect],[Total mileage])*10000