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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
AnnaMagnusson
Helper I
Helper I

Use selectedvalue from slicer in a visual with no interaction

Hi!

Is there a way to get the selectedvalue() from a slicer that has interactions turned off, from the visaul that I'm trying to use the measure on?
 
I've tried using 
PR =
var
A = CALCULATE([ParetoRank], Dim_Machine[Name] = "A", all(Dim_Machine_Comp[Name]))
var B = CALCULATE([ParetoRank], Dim_Machine[Name] = "B", all(Dim_Machine_Comp[Name]))
var selM = SELECTEDVALUE(dim_Machine[Name])
return
SWITCH( TRUE(),
selM = "A", 1,
selM = "B", 2
)
 
or if I change true() against selM and just write "A" instead of selM="A" then it either says I can't use "A" against a true/false or it doesn't show anything.
 
I know this queation has been upp some years ago but it looks like nobody has solved it yet. 
 
The slicer I use is a table dim_machine with columns id (1, 2, 3, 4) and name(A, B, C, D) and another table dim_machine_comp looks exactly the same.
1 ACCEPTED SOLUTION

@parry2k, I think I have solved my problem with another solution.

I kept the interaction but used removefilters() on the measures that I have in the visual. 

 

But thanks for helping 🙂

View solution in original post

5 REPLIES 5
parry2k
Super User
Super User

@AnnaMagnusson yes exactly and it should work. Share pbix file and remove sensitive information before sharing.

 

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k, I think I have solved my problem with another solution.

I kept the interaction but used removefilters() on the measures that I have in the visual. 

 

But thanks for helping 🙂

 

@parry2k , unfortunaly I can't share some pbix since alot of the information is sensitive even if I remove most of it. Sorry if that makes it harder/impossible to solve.

But when I use a disconnected table as a slicer I still get blank, so it think that I have not selected anything, and just use the default blank option. Other things that I have tried to use is


contains(dim_machine, dim_machine[name], "A"), A,

contains(dim_machine, dim_machine[name], "B"), B

 

within the switch but it just use the first line so only works when "A" is selected in the slicer is that is on the first line. And now I'm looking at keeping the interaction but use removefilter() somehow.

parry2k
Super User
Super User

@AnnaMagnusson well, in this case, create a disconnected table and then use a column from that table in the slicer, in that case, you will be able to get the selectedvalue from the slicer.

 

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

You mean add a slicer from another table, that looks exactly like dim_machine, but doesn't have a relation and use 
var selM = selectedvalue(machine[Name]) 
and then

return
SWITCH( TRUE(),
selM = "A", 1,
selM = "B", 2
)
because I've tried that but still not workning...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.