Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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.
User | Count |
---|---|
25 | |
12 | |
8 | |
6 | |
6 |
User | Count |
---|---|
26 | |
12 | |
12 | |
10 | |
6 |