The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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 |
---|---|
24 | |
10 | |
8 | |
7 | |
6 |
User | Count |
---|---|
31 | |
12 | |
10 | |
10 | |
9 |