Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Select Value as variable not working

Hello !   Im trying to change and old DAX that is not working anymore due to the year change, the last analyst didn´t considered year change.   So my ideia is to use SELECTEDVALUE as a variable o...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Anonymous 

    I don't think you can just use selectedvalue() directly on the current table. Try following:

    1. create a new table with year column, more years if needed.

    2. You do not need VAR Year, remove it. And change the return formula:

    Return

    SWITCH(SELECTEDVALUE(NewTable[Year]),
    2019, (A-A)*D,
    2020, (B-A)*E)

     


    Paul Zheng _ Community Support Team
    If this post helps, please Accept it as the solution to help the other members find it more quickly.