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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

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

@Anonymous 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.

Anonymous
Not applicable

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

@Anonymous 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.

Anonymous
Not applicable

Yes, that is correct!

@Anonymous 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.

Anonymous
Not applicable

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.

Anonymous
Not applicable

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

@Anonymous 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.

Anonymous
Not applicable

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

@Anonymous 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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors