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
Hyperchef1969
Helper V
Helper V

Change visual format when slicer selection changes

Hi,

 

I have a slicer containing 'lines' and 'percentage'. Dependent on the selection, I want the format of the table visual (see printscreen) to be adjusted to number when lines is selected or percentage when percentage is selected. How should I achieve this? The values or percentages in the table are a measure selection out of 'slicer_table'.

 

Table_measure_selection =
SWITCH( UPPER(SELECTEDVALUE(Slicer_table[Key])),
"YTD_OTAE",[YTD % On time or early],
"YTD_OTAE_lines",[YTD_inbound_lines_in_time_or_early],
"YTD_OT",[YTD % On time],
"YTD_OT_lines",[YTD_inbound_lines_in_time],
"YTD_E",[YTD % Early],
"YTD_E_lines",[YTD_inbound_lines_early],
"YTD_L",[YTD % Late],
"YTD_L_lines",[YTD_inbound_lines_late],
"MTD_OTAE",[MTD % On time or early],
"MTD_OTAE_lines",[MTD_inbound_lines_in_time_or_early],
"MTD_OT",[MTD % On time],
"MTD_OT_lines",[MTD_inbound_lines_in_time],
"MTD_E",[MTD % Early],
"MTD_E_lines",[MTD_inbound_lines_early],
"MTD_L",[MTD % Late],
"MTD_L_lines",[MTD_inbound_lines_late],
"RT_OTAE",[RT % On time and early],
"RT_OTAE_lines",[Running_total_on_time_and_early],
"RT_OT",[RT % On time],
"RT_OT_lines",[Running_total_on_time],
"RT_E",[RT % Early],
"RT_E_lines",[Running_total_early],
"RT_L",[RT % Late],
"RT_L_lines",[Running_total_late],
BLANK()
)

 

2019-12-09 14_27_08-OTD_Inbound_Rev2 (UC_OTD_Lines_Tab_Supplier_performance) - Power BI Desktop.png 

 

 

10 REPLIES 10
parry2k
Super User
Super User

@Hyperchef1969 Are you getting the correct measure with current switch condition? 



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.

Yes, it is only presented in percentages when I switch to lines.

@Hyperchef1969 ok but you are getting lines measure value although it is shown as %, correct?



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.

Yes, that is correct!

@Hyperchef1969 so you need to use format function to return text value and use format expression based on Line or % selection

 

Your measure = 
VAR __yourvalue = <existing switch function>
RETURN
IF ( SELECTEDVALUE (Table[Your line or % column] ) = "%",
FORMAT ( __yourvalue, "Percent" ),
FORMAT ( __yourvalue, "General Number" )
)

 



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,

 

For the table this helps perfectly, but I cannot select the new measure with the flexible format for a line graph. Do you know why? I need that also, so the line graph should also present percentages or lines.

 

Thanks for your help in advance.

Also the table format is text and not number I believe. I have to sort on totals when the table is showing lines and this is not working oke. 

2019-12-10 08_25_05-Window.png

@Hyperchef1969 with format your data is converted into text and thats why you cannot use it in line graph, to achieve this, you need to create bookmarks to show % and value line graph, you cannot achieve this with one measure.



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.

Thanks for the info. Can you help me ahead with achieving this with bookmarks?

@Hyperchef1969 this video will help



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.

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