Forum Discussion

ExcelUser's avatar
ExcelUser
Frequent Visitor
1 year ago
Solved

Make a calculated column return different dimensions based on parameter selection

Hi,

I would like the user to be able to display either an abbreviated or full Review Type, based on a selection in a slicer they choose. The slicer is based on a parameter I made.

 

I tried making a calculated column but it's not working as intended. I was expecting [Review] to look for the string in the parameter options and then return a desired dimension. But it's only returning Blank as far as I can tell.

 

Thank you for your help!

 

I've uploaded sample PBIX and XLSX to dropbox: 

Data: https://www.dropbox.com/scl/fi/vba3v37tm8ev4fo9lbs72/test_data.xlsx?rlkey=xl30t5mzwiczzftaqj6ui875v&st=61e7r54g&dl=0

 

Dashboard: https://www.dropbox.com/scl/fi/dw0ykhhz81plxvyaooj4g/dummy-dashboard.pbix?rlkey=rigpbdczptqh0uqkzcbimkzdj&st=folsx4z9&dl=0

 

 

Review =
SWITCH(
    TRUE(),
    SELECTEDVALUE('PSI/PC-06 Review Details'[PSI/PC-06 Details]) = "Aggregate Review Types",test_data[REVIEW TYPE],
    SELECTEDVALUE('PSI/PC-06 Review Details'[PSI/PC-06 Details]) = "Separate Review Types",test_data[Full Review Type],
    BLANK()
)
  • Hi ExcelUser 

     

    Calculated columns aren't affected by slicers since they are calculated during refresh.

    I replaced your calculated column with the following measure:  (After re-reading your post, your code should work as a measure - NOT a calculated column.  The calculated column in your pbix is missing the TRUE() line changing the meaning of the whole SWITCH() statement.)

     

    Review = 
        SWITCH(
            SELECTEDVALUE('PSI/PC-06 Review Details'[PSI/PC-06 Details]),
                "Aggregate Review Types", 
                MIN( test_data[REVIEW TYPE] ),
                "Separate Review Types",  
                MIN( test_data[Full Review Type] )
        )

     

    Let me know if you have any questions.

     

    MY dummy dashboard.pbix

     

7 Replies

  • Hi ExcelUser 

     

    Calculated columns aren't affected by slicers since they are calculated during refresh.

    I replaced your calculated column with the following measure:  (After re-reading your post, your code should work as a measure - NOT a calculated column.  The calculated column in your pbix is missing the TRUE() line changing the meaning of the whole SWITCH() statement.)

     

    Review = 
        SWITCH(
            SELECTEDVALUE('PSI/PC-06 Review Details'[PSI/PC-06 Details]),
                "Aggregate Review Types", 
                MIN( test_data[REVIEW TYPE] ),
                "Separate Review Types",  
                MIN( test_data[Full Review Type] )
        )

     

    Let me know if you have any questions.

     

    MY dummy dashboard.pbix

     

    • ExcelUser's avatar
      ExcelUser
      Frequent Visitor

      Thank you for taking the time to answer. Your solution helped solved my problem.

       

      Thanks for the FYI about calculated columns being refresh-dependent.