Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin 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.
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:
I've tried adding a trim & clean to the column with the examples to no avail.
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!!
Solved! Go to Solution.
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.
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.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
9 | |
8 | |
8 |
User | Count |
---|---|
14 | |
12 | |
11 | |
11 | |
8 |