Forum Discussion

JasMack's avatar
JasMack
Frequent Visitor
3 years ago
Solved

Getting the value of a selection

Hi all,

I have a slicer for the field "year" which is as follows:

I built a measure: Selection = selectedvalue(financials[Year])

I tested using a card to see if the measure is updating according to the option chosen in the slicer above. It works fine.

Then, I tried to build a calculated column to hold the value selected: 

Test = if([Selection]=2013, "haha","hoho")

However, I see that the calculated column is not working as intended. I expected to see "haha" for all rows when 2013 is selected in the slicer and "hoho" when 2014 is selected.

 

Anyone has an idea how to make it work as I want it to work?

 

Thanks.

 

Jason

 

  • Hi JasMack 
    Selected value and other functions that "on the flight"  cannot work as calculated columns.
    Because it depends on visuals, they are working only on report view.
    So if you want to use it as a condition it should be a measeure too.
    Read the linked blog post for more information:
    https://endjin.com/blog/2022/04/measures-vs-calculated-columns-in-dax
    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

     

2 Replies

  • Hi JasMack 
    Selected value and other functions that "on the flight"  cannot work as calculated columns.
    Because it depends on visuals, they are working only on report view.
    So if you want to use it as a condition it should be a measeure too.
    Read the linked blog post for more information:
    https://endjin.com/blog/2022/04/measures-vs-calculated-columns-in-dax
    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi JasMack,

    Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.

    If these also don't help, please share more detailed information and description to help us clarify your scenario to test.

    How to Get Your Question Answered Quickly 

    Regards,

    Xiaoxin Sheng