Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi @Anonymous
Opening a new thread as I am still experencing the format issue: When adding a new attribute/calculation ("ASP, EUR/lt") I am not able to give decimal format. Below what I have tried:
Many thanks 🙂
1) Included in the PnL Structure as a new attribute:
2) Included as a PnL value:
Solved! Go to Solution.
Hey @Msampedro ,
You're attempting to display a calculated value for the attribute "ASP, EUR/lt" with two decimal places, but it's not formatting correctly in your Power BI report. You've added the new attribute in your data table, implemented the logic in the measure, and defined a formatting rule, but the final result doesn't show as expected.
You’ve correctly inserted "ASP, EUR/lt" into your DATATABLE definition. However, even a minor difference like an extra space or invisible character can break the string match. To safeguard against this, use the TRIM() function to clean up the string during comparison:
VAR SelectedAttribute = TRIM(SELECTEDVALUE('PnL Structure'[Attribute]))For "ASP, EUR/lt", your calculation logic seems appropriate:
DIVIDE(NetSales, QtyLiter)
Just make sure that QtyLiter is not blank or zero to avoid unexpected results. You could also add a BLANK() fallback if needed.
In your formatting section, you're using this:
FORMAT(BaseValue, "0.00")
This is the right way to show two decimal places. However, if Power BI falls into the TRUE fallback case instead, it might display a rounded value without decimals.
Make the switch condition more reliable by trimming the selected value and explicitly formatting each case:
PnL Value (Formatted) =
VAR BaseValue = [PnL Value]
VAR SelectedAttribute = TRIM(SELECTEDVALUE('PnL Structure'[Attribute]))
RETURN
SWITCH(
TRUE(),
SelectedAttribute IN {"VM %", "GM %"}, FORMAT(BaseValue, "0.00%"),
SelectedAttribute = "ASP, EUR/lt", FORMAT(BaseValue, "0.00"),
TRUE, FORMAT(BaseValue, "#,##0")
)If you're unsure which attribute is actually selected, create a temporary measure to show it in a card:
Check Attribute = SELECTEDVALUE('PnL Structure'[Attribute])This helps confirm whether "ASP, EUR/lt" is selected correctly or not.
Use TRIM() to avoid mismatch issues due to spacing.
Validate that the correct attribute is selected by visual inspection.
Ensure the fallback in SWITCH doesn’t override your formatting logic.
Use the "0.00" format explicitly for values where decimals are important.
If you found this solution helpful, please consider accepting it and giving it a kudos (Like) it’s greatly appreciated and helps others find the solution more easily.
Best Regards,
Nasif Azam
Hey @Msampedro ,
You're attempting to display a calculated value for the attribute "ASP, EUR/lt" with two decimal places, but it's not formatting correctly in your Power BI report. You've added the new attribute in your data table, implemented the logic in the measure, and defined a formatting rule, but the final result doesn't show as expected.
You’ve correctly inserted "ASP, EUR/lt" into your DATATABLE definition. However, even a minor difference like an extra space or invisible character can break the string match. To safeguard against this, use the TRIM() function to clean up the string during comparison:
VAR SelectedAttribute = TRIM(SELECTEDVALUE('PnL Structure'[Attribute]))For "ASP, EUR/lt", your calculation logic seems appropriate:
DIVIDE(NetSales, QtyLiter)
Just make sure that QtyLiter is not blank or zero to avoid unexpected results. You could also add a BLANK() fallback if needed.
In your formatting section, you're using this:
FORMAT(BaseValue, "0.00")
This is the right way to show two decimal places. However, if Power BI falls into the TRUE fallback case instead, it might display a rounded value without decimals.
Make the switch condition more reliable by trimming the selected value and explicitly formatting each case:
PnL Value (Formatted) =
VAR BaseValue = [PnL Value]
VAR SelectedAttribute = TRIM(SELECTEDVALUE('PnL Structure'[Attribute]))
RETURN
SWITCH(
TRUE(),
SelectedAttribute IN {"VM %", "GM %"}, FORMAT(BaseValue, "0.00%"),
SelectedAttribute = "ASP, EUR/lt", FORMAT(BaseValue, "0.00"),
TRUE, FORMAT(BaseValue, "#,##0")
)If you're unsure which attribute is actually selected, create a temporary measure to show it in a card:
Check Attribute = SELECTEDVALUE('PnL Structure'[Attribute])This helps confirm whether "ASP, EUR/lt" is selected correctly or not.
Use TRIM() to avoid mismatch issues due to spacing.
Validate that the correct attribute is selected by visual inspection.
Ensure the fallback in SWITCH doesn’t override your formatting logic.
Use the "0.00" format explicitly for values where decimals are important.
If you found this solution helpful, please consider accepting it and giving it a kudos (Like) it’s greatly appreciated and helps others find the solution more easily.
Best Regards,
Nasif Azam
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 37 | |
| 37 | |
| 33 | |
| 32 | |
| 29 |
| User | Count |
|---|---|
| 130 | |
| 88 | |
| 82 | |
| 68 | |
| 64 |