Forum Discussion

nick9one1's avatar
nick9one1
Icon for Helper III rankHelper III
3 years ago
Solved

Total isn't being calculated correctly


I have this Matrix, built from two tables. 

Category table

 

related one to many to this table 

 

 

 

I need to calculate a score for each category. 

Performance score = ((Points Available - Demerits)/Points Available)*Weighting

I've created measure to calculate this, and each row is correct. But the total is wrong. 

 

 

Demerits = SUM(Submissions[Demerits])

 

 

Points Achieved = SUM('Categories'[cr20b_pointsavailable])-[Demerits]
Weighting = SUM(Categories[cr20b_weighting])
Performance Score = (([Points Achieved]/[Points Available]*[Weighting])/[Weighting])

 

 

 

 





  • Hi nick9one1 ,

    Measures are calculated by context, in other words, measure is calculated based on the value of current row.

    From your snapshot can see, the result of total is correct in calculation: (145/163*20)/20=88.96%

    If you want the total is sum of all rows, try the solution:

    Measure =
    VAR _T =
        ADDCOLUMNS ( 'Categories', "Column", [Performance Score] )
    RETURN
        IF (
            HASONEVALUE ( [Category Ordered] ),
            [Performance Score],
            SUMX ( _T, [Column] )
        )
    

    Best Regards,
    Community Support Team _ kalyj

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

3 Replies

  • Hi nick9one1 ,

    Measures are calculated by context, in other words, measure is calculated based on the value of current row.

    From your snapshot can see, the result of total is correct in calculation: (145/163*20)/20=88.96%

    If you want the total is sum of all rows, try the solution:

    Measure =
    VAR _T =
        ADDCOLUMNS ( 'Categories', "Column", [Performance Score] )
    RETURN
        IF (
            HASONEVALUE ( [Category Ordered] ),
            [Performance Score],
            SUMX ( _T, [Column] )
        )
    

    Best Regards,
    Community Support Team _ kalyj

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Hi nick9one1 ,

    Is your problem solved? If so, would you mind accept the helpful replies as solutions? Then we are able to close the thread. More people who have the same requirment will find the solution quickly and benefit here, thank you!

     

    Best Regards,
    Community Support Team _ kalyj