Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Red217
Helper III
Helper III

How to use TREATAS with SelecetedValue

Hi, 

 

i have many slicers to get a measurement,

one of them is a "switch" with several scenarios when i am copying the DAX from the analyzer i get this:

 

VAR __DS0FilterTable5 =
TREATAS({"Worst Case"}, 'Main Case Scenario Slicer'[Case Scenario Slicer])

 

i wanted to the value to be the SELECETEDVALUE('Main Case Scenario Slicer'[Case Scenario Slicer])

 

but it doesnt work, how do i get the TREATAS to work with the actual value selected in the slicer ?

3 REPLIES 3
tamerj1
Super User
Super User

@Red217 

If you are thinking of creating a dynamic calculated table then you have to know that calculated tables do not interact with the filter context thus they cannot be dynamic. If you are creating a measure then none of that would be required. 

tamerj1
Super User
Super User

Hi @Red217 

this is done automatically this why it's hard coded. What exactly are you trying to accomplish?

Hi , 

i am trying to run a query that export the current measurements from power bi, 

the measurement have MANY filters and Slicers and i want to use them dynamically, based on the filter selection the user have seleceted in the report

 

for example when i review the dax now i get this (as part of it )

TREATAS({"Worst Case"}, 'Main Case Scenario Slicer'[Case Scenario Slicer])

 

in the case above the user have selected "worst case" in the filter, but i wanted it to be something like

TREATAS (selecetedvalue... in the Slicer)

 

so the code will actually export based on the filter selection and not based on the static code

 

thanks

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors