Forum Discussion

INJAINP's avatar
INJAINP
Frequent Visitor
7 years ago
Solved

If with Filter

Hello Folks,   I have a requirement as follows :   there are 3 values in slicer. Suppose the are A , B and C. If A gets selected then a measure value corresponding to A should be displayed and si...
  • v-chuncz-msft's avatar
    7 years ago

    INJAINP,

     

    You may refer to the DAX below.

    Measure =
    VAR s =
        SELECTEDVALUE ( Table1[Column1] )
    RETURN
        IF (
            ISBLANK ( s ),
            SUMX (
                VALUES ( Table1[Column1] ),
                CALCULATE (
                    SWITCH ( SELECTEDVALUE ( Table1[Column1] ), "A", 0.2, "B", 0.6, "C", 0.2 )
                        * SUM ( Table1[Column2] )
                )
            ),
            SUM ( Table1[Column2] )
        )