cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
marcos_osorio
Helper II
Helper II

Use Slicer value as Variable

Hi, i want to have a table with calculated columns, in one column I set the value to 1 if the value is related with another table. 

This works perfect but its not ver y dynamic. 

So i want to know if there is a way to set for example a Slicer and use that value in the calculated column. 

I mean, to use the slicer selection in the calculated column of the table.

 

 

Thank you very much.

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Yes, I thought it wasn't possible because PowerBI can't really handle user input data. Even though it has problems, at least it's possible 

View solution in original post

6 REPLIES 6
Cmcmahan
Resident Rockstar
Resident Rockstar

Yeah, this is possible. I've used it as a janky way to set up input variables on a report before.  The trick is using SELECTEDVALUE to get one value out of a list of values.

 

You have to explicity declare all the values that the SLICER value can be, but it works.  If you wanted to get a percentage of a value in Table1 with a slicer you could do the following:

Create a table of values 0-100 called "SlicerValues".  Create a slicer that slices SlicerValues[value].  Create a measure or calculated column in Table1 as appropriate with code like:

Portion of Data = Table1[Value]*SELECTEDVALUE(SlicerValues[value])/100

This has limitations, like the slicer only has whatever range you set as available, but gets the job done.

Thanks @Cmcmahan  this is same what i am doing but is it possible to get more than 1 value is stored and used in measure. I have explained in below thread if you can provide some input that will be very helpful.

 

https://community.powerbi.com/t5/Desktop/Slicer-with-position-of-choice-to-see-what-user-has-selecte...

 

Regards

 

Anonymous
Not applicable

Wow, that's a great way of solving this problem. Didn't know about it! 

 

As it turns out, I was wrong hahaha

It's super unreliable, and doesn't work well unless you can enumerate all the values possible for the selection.  PowerBI just isn't generally meant for on the fly dynamic calculations based on a value the report viewer sets.

Anonymous
Not applicable

Yes, I thought it wasn't possible because PowerBI can't really handle user input data. Even though it has problems, at least it's possible 

View solution in original post

Anonymous
Not applicable

As of now, I don't think it's possible. Maybe in a future update. 

 

But I may be wrong! 

Helpful resources

Announcements
Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Top Solution Authors
Top Kudoed Authors