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
CR
Resolver II
Resolver II

if selectedvalue equals then filter in a slicer

Hi guys,

 

I would like that one specific value will be selected dynamically in a slicer based on one condition.

 

I got the table TimeFrame.

1.png

 

 

ProjectId	TimeFrame	Data	FilterOption
4019	TimeFrame1	Data1	0
4019	TimeFrame1	Data2	0
4019	TimeFrame1	Data3	0
4019	TimeFrame2	Data4	0
4019	TimeFrame2	Data5	0
4019	TimeFrame2	Data6	0
9028	TimeFrame1	Data1	1
9028	TimeFrame1	Data2	1
9028	TimeFrame1	Data3	1
9028	TimeFrame3	Data4	0
9028	TimeFrame3	Data5	0
9028	TimeFrame3	Data6	0

 

I get 2 visuals: one table and one slicer.

1 get one filter: ProjectId

CR_0-1623159445395.png

I would like that:

- when I filter on the project 4019, TimeFrame 1 & 2 are both displayed (classic display)

- when I filter on the project 9028, TimeFrame are filtered directly on TimeFrame1 only

By filtering, I mean => TimeFrame1 is selected automatically in the slicer (the other time frame remains selectable)

CR_1-1623159650533.png

 

I tried to create a measure combining IF SELECTEDVALUE = 9028 then FILTER ON but I don't see how to get it right and, above all, how to assign this measure to a slicer.

 

Someone already solved this kind of case ?

 

Thanks,

CR

 

6 REPLIES 6
parry2k
Super User
Super User

@CR as mentioned you cannot set the default value in the slicer but you can always set the default value in the SELECTEDVALUE function which is the 2nd parameter:

 

For example:

 

My Value = 
SELECTEDVALUE ( 
Table[Column], 
//this is where you can put the logic for default value based on project
SWITCH ( MAX ( Table[Project] ),
   "Project1", "TimeFrame1",
   "Project2", "TimeFrame2",
   "TimeFrame0" 
)
)

 

Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS  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.

Ok, noted. It's just I don't understand what you are doing in this measure and how / where you apply it... To be investigated.

parry2k
Super User
Super User

@CR what are these 3 and 72? How this decision is made?

 

Read this post to get your answer quickly.

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



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.

Sorry, i mean:

- the TimeFrame 3 for project 2

- the TimeFrame 72 for project 4, etc.

 

The timeframe is a step of a project but not linked to a planning, a date.

This is just decided and defined by the project manager that said for example on January 1st that the project 2 is on TimeFrame 3 and, let's say on March 23th, the project 2 moves to the TimeFrame 4. That's it.

However, it is also possibe that the TimeFrame to "pre-select" is the number 3 even if you are still on February (so link with the date of the day as well).

 

All visuals available in the sheets are linked to the TimeFrame so, it is really better to be able to select a specific TimeFrame by project, whenever we need, to display visuals according to the TimeFrame we want (but we have to keep the other ones in the slicer !).

 

Last information => the report gathers all the projects so we need to find a way to assign the TimeFrame we want for each project within the same report.

 

Hope it's more clear.

CR

parry2k
Super User
Super User

@CR what is your end goal? You can't select values in the slicer automatically but if we know what is your end goal there might be a solution. 



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.

Hi,

The goal is, when the list of TimeFrame (1 to 100) is very high on some projects, I need to select one specific value by default for each project (the 3 for project 2, the 72 for project 4, etc.).

CR

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.