Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Add selected constant from slicer to table

I need some help.  I work with medical data.  I have created a _ChooseOrgan table to select the appropriate Organ (Column=OrganChoices) (Heart, Lung, Kidney, etc).  Then I created a measure for the choice selected

SelectedOrgan = SELECTEDVALUE(_ChooseOrgan[OrganChoices])

 

We are in the process of restructuring our data.  But currently, I have a very wide table with separate columns for each organ and its respective data/metrics (Kidney Date, Kidney Value, Heart Date, Heart Value, etc).  What I want to do is pass the SelectedOrgan choice (a single value from the slicer) to the data table in a new column as a constant.  Then, I could create new columns in my data table based on a switch statement like this example

SelectedIntent = SWITCH(True(),
[Selected Organ]="Heart",v_Organ[HeartOrIntent],
[Selected Organ]="Liver",v_Organ[LiverOrIntent],
[Selected Organ]="Intestine",v_Organ[IntestineOrIntent],
BLANK())

 

But I cannot get the slicer choice in the data table.  Please, please give me a helpful tip!

3 Replies

  • The issue is that Calculated Columns update their values at the moment of their creation and then do not check for changes to the data until the dataset refreshes. In your example, your SWITCH() based column would look at the current selection and populate the results. If you then selected something else, it would ignore your change until the dataset refreshed.

  • Icey's avatar
    Icey
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    It is suggested to use "UnPivot" to restructure your data. Please check this video and the attached PBIX file.

    The final data structure:

     

     

    Best Regards,

    Icey

     

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

  • Icey's avatar
    Icey
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    Is this problem solved?


    If it is solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.


    If not, please let me know.

     


    Best Regards,
    Icey