Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Help.. Selectedvalue issue / chart

I am trying to achieve TOP & keep getting BOTTOM (error).

 

DAX used:

Var Y2021 = ...
return
if(selectedvalue('Date'[Month]) > 3*, blank(), Y2021) 
*Edited
 
I will get "TOP" (desired)
 
'Date'[Month] = 3 in this case (value)
But I am trying to sync my slicer here as well. E.g. if March selected, April onwards should not be showing any figure. So I tried below DAX
 
if(selectedvalue('Date'[Month]) > selectedvalue('Date'[Month]), blank(), Y2021)
 
It wont work. Why?!
I am trying to change the "4" to a valid DAX but cant figure for the life of me what to do. Please help me.
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi  Anonymous ,

    I created the data:

    Table:

    Date Table:

    Here are the steps you can follow:

    1. Create meausre.

    Total = SUMX(FILTER(ALL('Table'),'Table'[Month]=MAX('Date'[Month])),'Table'[amount])

    Result:

    Flag =
    var _selectvalue=SELECTEDVALUE('Slice'[Month])
    return
    IF(MAX('Date'[Month]) <=_selectvalue,1,0)

    2. Use enter data to create a Slice table.

    3. Set the Month of the Slice table as the slicer.

    4. Put Flag into Filter, set is =1, and apply filter.

    5. Result.

    When the slicer is 3, the data of the previous three months is displayed.

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

4 Replies

  • selimovd's avatar
    selimovd
    Most Valuable Professional

    Hey Anonymous ,

     

    can you create a new measure with "selectedvalue('Date'[Month])" and return that in a card visual?

    Does it return "3" or "March"?

     

    If it returns "March" then the formula with > 4 wouldn't work. You could then do a lookup.

    Let me konw, I can help you with that.

     

    If you need any help please let me know.
    If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
     
    Best regards
    Denis
     
    • Anonymous's avatar
      Anonymous
      Not applicable

      Hello.. it returns a "3" not march so im confused why it wouldn't work!

      Here is the [date] table if anything can be used:

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  Anonymous ,

    I created the data:

    Table:

    Date Table:

    Here are the steps you can follow:

    1. Create meausre.

    Total = SUMX(FILTER(ALL('Table'),'Table'[Month]=MAX('Date'[Month])),'Table'[amount])

    Result:

    Flag =
    var _selectvalue=SELECTEDVALUE('Slice'[Month])
    return
    IF(MAX('Date'[Month]) <=_selectvalue,1,0)

    2. Use enter data to create a Slice table.

    3. Set the Month of the Slice table as the slicer.

    4. Put Flag into Filter, set is =1, and apply filter.

    5. Result.

    When the slicer is 3, the data of the previous three months is displayed.

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.