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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Need Help: Currency Formatting with DAX & Table failing on some values, not all values

Hi all,

 

I have a table of Currency Types that includes a column which is the formatting string for each unique currency. I have a measure whose value I want to format based on the user selecting a single currency in the report (using a slicer). The weird thing, is that it works for some of the values, but fails on others, with the following error:

rpiboy1_0-1657829382396.png

I've tried adding a trim & clean to the column with the examples to no avail.

rpiboy1_1-1657829440949.png

 

Here is the DAX I'm using, its pretty straigh-forward. I've also confirmed that the variables in each case are reporting the expected value, the formula only fails (on some selections) when I implement the Result step.

 

 

Cnst. Cost Formatted = 
    VAR CurrencyFormat =
        SELECTEDVALUE( 'Currency Types'[Example], "#,0" )

    VAR CurrencyVal = ROUND( [Const $ Esc. Cnvrt.], -3)

    VAR Result =
        FORMAT( CurrencyVal, CurrencyFormat )
        

RETURN
    //CurrencyFormat
    //CurrencyVal
    Result

 

 


Suggestions or help much appreciated!!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Ok, I  confess to being an idiot (this is why I shouldn't write code). Did not look closely enough at the reserve table for the FORMAT function. All the errors were related to reserved chacacters that needed to be escaped. Note that capitlaization does not matter for reserved alphabetic characters when using the FORMAT function in DAX, so m and M are the same, or S and s.

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Ok, I  confess to being an idiot (this is why I shouldn't write code). Did not look closely enough at the reserve table for the FORMAT function. All the errors were related to reserved chacacters that needed to be escaped. Note that capitlaization does not matter for reserved alphabetic characters when using the FORMAT function in DAX, so m and M are the same, or S and s.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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