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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
AndySmith
Helper III
Helper III

Switch Selected Values - conditional formatting

Hi all

 

I have a Switch selected values expression to toggle between various user selected MTD measures. However some of these measures are $ and some will be %. Is it possible to combine the Format function with the below DAX? So something along the lines of 'IF(selected value = 5, Format "%", else $'

 

MTD = SWITCH(SELECTEDVALUE(Options[Index]),1,[Calc - Revenue - MTD],2,[Calc - DMP - MTD],3,[Calc - GM - MTD],4,[Calc - COGS - MTD],5,[Calc - DMP % - MTD],6,[Calc - Net Margin - MTD])
1 ACCEPTED SOLUTION
v-kelly-msft
Community Support
Community Support

Hi @AndySmith ,

 

Is below what you need?

v-kelly-msft_1-1614046791511.png

 

If so,create a measure similarly as below:

MTD = SWITCH(SELECTEDVALUE('Table'[Index]),
5,FORMAT([Calc - Revenue - MTD],"percent"),
"$"&[Calc - Revenue - MTD])

For the related .pbix file,pls see attached.

 

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

View solution in original post

4 REPLIES 4
v-kelly-msft
Community Support
Community Support

Hi @AndySmith ,

 

Is below what you need?

v-kelly-msft_1-1614046791511.png

 

If so,create a measure similarly as below:

MTD = SWITCH(SELECTEDVALUE('Table'[Index]),
5,FORMAT([Calc - Revenue - MTD],"percent"),
"$"&[Calc - Revenue - MTD])

For the related .pbix file,pls see attached.

 

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

Anand24
Super User
Super User

Hi @AndySmith ,

I don't think this will be possible because its like having different formatting on the same measure which is not allowed in Power BI.

If its okay for you to have these values as text, then you can probably have the DAX accordingly.

 

PBI_SuperUser_Rank@1x.png  

Give a Thumbs Up if this post helped you in any way and Mark This Post as Solution if it solved your query !!!

Proud To Be a Super User !!!
LinkedIn

How would they be displayed as text?

@AndySmith ,
They will be just text values. You won't be able to get any aggregations that you are currently getting in your measure selector I guess.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.