Search code examples
powerbidaxdata-analysispowerbi-desktopmeasure

FILTER and SUMX in DAX


I would like to add a filter option in the code below. How to get around this ? many thanks in advance.

_RateMeasure = SUMX(myDF,
                    myDF[Amount]*RELATED('Currency Conversion'[RateCol1]))

what I am trying seems not filtering properly

  _RateMeasure = SUMX(FILTER(myDF, myDF[COL] = "ABC"), 
                      myDF[Amount]*RELATED('Currency Conversion'[RateCol1]))

Solution

  • Try this instead:

    _RateMeasure =
    CALCULATE (
        SUMX (
            myDF,
            myDF[Amount]
                * RELATED ( 'Currency Conversion'[RateCol1] )
        ),
        FILTER (
            myDF,
            myDF[COL] = "ABC"
        )
    )