Forum Discussion

evebarratt's avatar
evebarratt
Helper I
4 years ago
Solved

Incorrect Total using Sum, Sumx, and IF Dax

Hi, I have below dataset and table visual.         I got incorrect total from 'Price-GST(Wrong)' measure.   Price-GST(wrong) = VAR withoutGST = SUM('Table'[Price]) VAR withGST = SUM...
  • Jihwan_Kim's avatar
    4 years ago

    Hi,

    Please try the below measure.

     

    New measure: =
    SUMX (
        ADDCOLUMNS (
            VALUES ( Data[ID] ),
            "@condition",
                IF (
                    CALCULATE ( SELECTEDVALUE ( Data[GST] ) ) = 0,
                    CALCULATE ( SUM ( Data[Price] ) ),
                    CALCULATE ( SUM ( Data[Price] ) ) / 1.1
                )
        ),
        [@condition]
    )