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
Anonymous
Not applicable

Formatting Numbers in Switch Dax to show up in chart

Hello All, I have a slicer that switches between dollars and units for a measure. Here is the Dax

 

Payment Selection = if(ISCROSSFILTERED(MeasureType[Units]),
SWITCH( True(),
VALUES(MeasureType[Units]) = "Count", format([Total Payments],"0,000")
VALUES(MeasureType[Units]) = "Dollars", format([Total Payment$],"$0,000")
BLANK()),[Total Payments])
 
However If i try to format each meausre it does not show up in chart. Maybe because its a text? 
I want to be able to Show in a chart $0,000 if dollars is selected and whole number if count is selected. Is this possible?
5 REPLIES 5
Anonymous
Not applicable

Hi @Anonymous ,

Did I answer your question? Please mark my reply as solution, thank you~

Anonymous
Not applicable

Hi Unfortunetly it does not work still as it will not show up in a graph like a bar or line chart as it is presented as a string. Any ideas how to fix?

Anonymous
Not applicable

Hi @Anonymous ,

According to my understanding, you want to dynamically display the formatted value based on slicer, right?

Here are my data sample:

8.20.4.1.PNG

You could use the following formula:

Total Payments =
FORMAT ( SELECTEDVALUE ( Pay[Payment] ), "0,000" )
Total Payment$ =
FORMAT ( SELECTEDVALUE ( Pay[Payment] ), "$0,000" )
Payment Selection =
SWITCH (
    SELECTEDVALUE ( 'MeasureType'[Units] ),
    "Count", [Total Payments],
    "Dollars", [Total Payment$]
)

My visualization looks like this:

8.20.4.2.png

Is the result what you want? If you have any questions, please upload some data samples and expected output.

Please do mask sensitive data before uploading.

 

Best Regards,

Eyelyn Qin

 

FrankAT
Community Champion
Community Champion

Hi @Anonymous 

use the external tool tabular editor. Take a look at the following link:

https://www.kasperonbi.com/dynamic-formatstrings-with-calculation-groups/

 

Regards FrankAT

Anonymous
Not applicable

see my update. This wont show up in a  chart still.

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.