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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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