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
Femcold
Frequent Visitor

How can I add dynamic currency prefix in sales field to show it in a bar chart ?

I created a measure that adds a currency prefix to Revenue and this works perfectly for a table but it turns of the data lables for a bar chart, I read on blogs that the format statement in my dax formula is return a text value. How do i work around this?

 

Revenue =
var _revenue = SUM('Invoice lines'[Customer invoice line amount - accounting currency])
return
   
FORMAT(_revenue,
    SWITCH(
        SELECTEDVALUE('Entities'[ID],"20CA"),
        "20CA","$#,##0.##",
        "30US","$#,##0.##"
       
        )
)


 

1 ACCEPTED SOLUTION

Hi @Femcold ,

As a workaroud, you can use bookmark instead of slicer, here's the detailed steps:

1.Create measures for the result, and set each measure a seperate currency format.

USD = MAX('Table'[Sales])
GBP = MAX('Table'[Sales])

2.Create two charts with two measures seperately, and put them overlapping. Then create bookmarks with only one chart show and others hided. Now you can directly switch the bookmark to display charts with diffrent currency.

vkalyjmsft_0-1669961828306.png

vkalyjmsft_1-1669961848047.png

3.You can still create buttons, turn on the Action option and select corresponding bookmark.

vkalyjmsft_2-1669962082296.png

Now, you can change the data label by Ctrl+click the corresponding button.

vkalyjmsft_3-1669962211096.png

vkalyjmsft_4-1669962225706.png

Reference:Create report bookmarks in Power BI to share insights and build stories - Power BI | Microsoft Learn

Create buttons in Power BI reports - Power BI | Microsoft Learn

 

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
v-yanjiang-msft
Community Support
Community Support

Hi @Femcold ,

Does my solution work for you? If so, would you mind accept it as solution? Then we are able to close the thread. More people who have the same requirment will find the solution quickly and benefit here, thank you!

 

Best Regards,
Community Support Team _ kalyj

v-yanjiang-msft
Community Support
Community Support

Hi @Femcold ,

I think it's because the function FORMAT will return a text data, which cannot be displayed in the Y-axis of bar chart. The Y-axis of bar chart represent the size of value, it should be a number.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yanjiang-msft , what would be a possible remedy in this scenerio

Hi @Femcold ,

I think you can directly change the data format to Currency.

vkalyjmsft_3-1669602518603.png

You can also click the drop-down option besides the $ symbol, there're all currency symbols in it.

vkalyjmsft_2-1669602418862.png

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

hi @v-yanjiang-msft, thanks for your reply but i have three currencies that i am switching based on a slicer,

FORMAT(_sales,
    SWITCH(
        SELECTEDVALUE('Currency'[Currency Format],"USD"),
        "USD","$#,##0.##",
        "GBP","£#,##0.##",
        "Euro","€#,##0.##"
        )
)

 

The format automatically turns the Measure to a text and i cant use it in a chart

Hi @Femcold ,

As a workaroud, you can use bookmark instead of slicer, here's the detailed steps:

1.Create measures for the result, and set each measure a seperate currency format.

USD = MAX('Table'[Sales])
GBP = MAX('Table'[Sales])

2.Create two charts with two measures seperately, and put them overlapping. Then create bookmarks with only one chart show and others hided. Now you can directly switch the bookmark to display charts with diffrent currency.

vkalyjmsft_0-1669961828306.png

vkalyjmsft_1-1669961848047.png

3.You can still create buttons, turn on the Action option and select corresponding bookmark.

vkalyjmsft_2-1669962082296.png

Now, you can change the data label by Ctrl+click the corresponding button.

vkalyjmsft_3-1669962211096.png

vkalyjmsft_4-1669962225706.png

Reference:Create report bookmarks in Power BI to share insights and build stories - Power BI | Microsoft Learn

Create buttons in Power BI reports - Power BI | Microsoft Learn

 

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Femcold
Frequent Visitor

Femcold_0-1669313642984.png

Femcold_1-1669313661136.png

As you can see in the image the switch chnages the currency but removes the label on the chart

 

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