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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
alexkaranda
Frequent Visitor

How dynamically change the currency symbol for summarisation fields?

We are facing a challenge applying dynamically the right currency symbol based on the currency field from the table.

 

Using API, we are preparing  the following table with information about purchased products, where the key fields are:

  • created_at,
  • name,
  • row_total,
  • and currency. 

Where row_total is actually the purchased amount per order, it is decimal with enabled summarization. 

pb_table.jpg

 

The goal is to build a summarized report with the top 10 purchased products based on the row_total 

bp_graph (1).jpgpb_setting.jpg

 

Challenges:

  1. We can't use configuration settings to setup manually the right currency formatting. 
    1. currency might be changing depending on the data source
    2. this dashboard is not for developers, so we don't want to ask the sales representative each time to change currency manually
  2. FORMAT function is generating an error for Summarizing field
    1. We've created a new measure for formatting 
    2. currencyFormat = 
      var cur = CALCULATE(MIN(OrderItem[currency]))
      return switch(cur, "GBP","£#,##0.#", "EUR", "€#,##0.#", "$#,##0.#");
    3. Tried to apply the format function  
      FORMATED_ROW_TOTAL = FORMAT(row_total,currencyFormat )
    4. If it is just a regular table view, it shows nicely formatted values.
    5. But the problem, these are string values!
    6. And once we try to use it for the summary report it fails with the error "cannot convert string to integer"

 

In our case, the ideal scenario is to modify the row_total field "custom format" settings using DAX but seems it impossible. 

Or, using Parameters to define the current currency, which also seems also not possible.

 

One of the ideas was to prepare a separate measured table with already summarized and grouped data per product. 

But it sounds crazy and complex.  

 

Appreciate any reasonable ideas. 

 

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@alexkaranda,

 

You could try using a calculation group (see article below). A calculation group gives you more control over formatting and doesn't convert the data type to text.

 

https://www.sqlbi.com/articles/controlling-format-strings-in-calculation-groups/ 





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

Proud to be a Super User!




View solution in original post

2 REPLIES 2
DataInsights
Super User
Super User

@alexkaranda,

 

You could try using a calculation group (see article below). A calculation group gives you more control over formatting and doesn't convert the data type to text.

 

https://www.sqlbi.com/articles/controlling-format-strings-in-calculation-groups/ 





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

Proud to be a Super User!




This solution works perfectly for my case.

Not the ideal, but completely different level working  with Power BI

 

Capture.PNG

 

Some useful link who wants to learn more: 

https://learn.microsoft.com/en-us/training/modules/create-calculation-groups/5-lab

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.