Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Grand total error

 

Hello, the grand total is wrong. Can you help me? THK

 

 

 

  • Hi Anonymous ,

     

    To fix this issue, you can use the SUMX function to iterate over each row and apply your logic correctly for both rows and totals.

    Here’s how you can rewrite your measure:

    Obj.Ratio 10 = 
    SUMX(
        VALUES('YourTableName'),
        IF(
            AND([CA filtere P.T] > 600000, [Tx P.T] < 0.1),
            [Diff CA PT et 10%CA],
            0
        )
    )
    
    • SUMX(): Iterates over each row in your table and applies your logic.
    • VALUES('YourTableName'): Ensures it evaluates your logic row by row.

    This should give you the correct Grand Total that matches the row-level calculations.

     

    Best regards,

  • danextian's avatar
    danextian
    1 year ago

    he formula provided by DataNinja777  should be evaluated individually for each row, meaning you will get the row value based on the current context (same as in your screenshot). However, at the total level, the formula should return the sum of all those individual row evaluations.

3 Replies

  • Hi Anonymous ,

     

    To fix this issue, you can use the SUMX function to iterate over each row and apply your logic correctly for both rows and totals.

    Here’s how you can rewrite your measure:

    Obj.Ratio 10 = 
    SUMX(
        VALUES('YourTableName'),
        IF(
            AND([CA filtere P.T] > 600000, [Tx P.T] < 0.1),
            [Diff CA PT et 10%CA],
            0
        )
    )
    
    • SUMX(): Iterates over each row in your table and applies your logic.
    • VALUES('YourTableName'): Ensures it evaluates your logic row by row.

    This should give you the correct Grand Total that matches the row-level calculations.

     

    Best regards,

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you, but how can I make this function appear in the last row of my table, replacing the grand total?

      • danextian's avatar
        danextian
        Super User

        he formula provided by DataNinja777  should be evaluated individually for each row, meaning you will get the row value based on the current context (same as in your screenshot). However, at the total level, the formula should return the sum of all those individual row evaluations.