Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
How to apply dynamic formatting to the total.
I've applied dynamic formatting to distinguish between different currencies, € and $, but the total always appears in €, even if I only select data in $. How do I apply dynamic formatting to the total?
Here's what I've done
this is the formula I used
Solved! Go to Solution.
Hi @FilipaPereira - you can create a measure as like below:
Currency Used =
IF (
HASONEVALUE('Comisões'[Moeda]),
SELECTEDVALUE('Comisões'[Moeda]),
IF (
COUNTROWS(VALUES('Comisões'[Moeda])) = 1,
VALUES('Comisões'[Moeda]),
"Mixed"
)
)
another measure is for formatting the total detection follow: replace the table name as per your model
Formatted Total Commissions =
VAR _value = [TotalCommissions]
VAR _currency = [Currency Used]
RETURN
SWITCH(
_currency,
"USD", FORMAT(_value, "#,##0.00 $"),
"EUR", FORMAT(_value, "#,##0.00 €"),
"Mixed", FORMAT(_value, "#,##0.00") & " (Mixed)",
FORMAT(_value, "#,##0.00") // fallback
)
Hope this helps.
Proud to be a Super User! | |
At the total level, your formula using SELECTEDVALUE returns blank because there is likely more than one value in 'Comisões'[Moeda]. Since this does not satisfy the first condition in your SWITCH statement, the measure falls back to the alternative result. This usually happens when there is no direct relationship between the slicer column and the column you are referencing in the dynamic format string expression, so the context does not filter down as expected.
Hi @FilipaPereira - you can create a measure as like below:
Currency Used =
IF (
HASONEVALUE('Comisões'[Moeda]),
SELECTEDVALUE('Comisões'[Moeda]),
IF (
COUNTROWS(VALUES('Comisões'[Moeda])) = 1,
VALUES('Comisões'[Moeda]),
"Mixed"
)
)
another measure is for formatting the total detection follow: replace the table name as per your model
Formatted Total Commissions =
VAR _value = [TotalCommissions]
VAR _currency = [Currency Used]
RETURN
SWITCH(
_currency,
"USD", FORMAT(_value, "#,##0.00 $"),
"EUR", FORMAT(_value, "#,##0.00 €"),
"Mixed", FORMAT(_value, "#,##0.00") & " (Mixed)",
FORMAT(_value, "#,##0.00") // fallback
)
Hope this helps.
Proud to be a Super User! | |
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 48 | |
| 45 | |
| 41 | |
| 19 | |
| 18 |
| User | Count |
|---|---|
| 68 | |
| 67 | |
| 33 | |
| 31 | |
| 29 |