Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

DAX function remove filter

Hi All! Hope doing well,   I have an issue in one personal project im working on. I have a table called Costs which contains period, brand,team code,country, and values. Then i have another one ca...
  • bhanu_gautam's avatar
    2 years ago

    Anonymous , You can try using measures

     

    TotalCostsBrand3Months =
    VAR CurrentBrand = SELECTEDVALUE(Team[brand])
    VAR CurrentDate = MAX(Costs[period])
    RETURN
    CALCULATE(
    SUM(Costs[values]),
    Costs[brand] = CurrentBrand,
    Costs[period] >= EDATE(CurrentDate, -3)
    )

     


    TotalCostsBrandCountry3Months =
    VAR CurrentBrand = SELECTEDVALUE(Team[brand])
    VAR CurrentCountry = SELECTEDVALUE(Team[country])
    VAR CurrentDate = MAX(Costs[period])
    RETURN
    CALCULATE(
    SUM(Costs[values]),
    Costs[brand] = CurrentBrand,
    Costs[country] = CurrentCountry,
    Costs[period] >= EDATE(CurrentDate, -3)
    )