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 I am facing an issue with dynamic formatting.
The dynamic formatting code is shown below:
however, the formatting on the bar graph is completely out of place as shown below:
Any help will be highly appreciated!
Thank you!
Solved! Go to Solution.
Thanks for confirming those steps — sounds like you're doing everything right on the surface. Since the dynamic format still isn't applying in the visual, here are a few deeper checks you can try:
Make sure the dynamic format string is assigned to the same measure that’s being used in the visual. Sometimes a copy or renamed version of the measure is used in the chart, and the formatting doesn’t carry over.
If the visual still ignores the format string, you can try formatting the value manually in a new measure:
Formatted Value = VAR _value = [YourMeasure] VAR _format = SWITCH ( TRUE(), _value < 1E3, "#,0", _value < 1E6, "#,0.0,K", _value < 1E9, "#,0.0,,M", "#,0,,B" ) RETURN FORMAT(_value, _format)
Then use this Formatted Value in a card or table visual to test if the formatting logic works as expected.
⚠️Note: This won't work in bar/column charts directly since they expect numeric values — but it's a good way to debug the format logic.
Sometimes visuals cache formatting. Try:
Dynamic format strings don’t always apply to data labels in visuals like bar/column charts — especially if the visual is using auto-scaling or display units. In that case, it might be a current limitation of the visual engine.
translation and formatting supported by AI
Hi @pp_123 ,
The issue is caused by Power BI’s visual-level auto-scaling adding units like “K” or “M” on top of your dynamic DAX formatting, which also includes “K” or “M”. This results in labels like “0.0KK” or “0.0KM”. Although your formatting works correctly in a table visual, bar or column charts apply their own unit scaling unless explicitly told not to. To fix this, go to the visual where the labels are incorrect, then under the format pane, find the axis or data label settings and set the “Display units” to “None” instead of “Auto”. This disables Power BI’s automatic abbreviation and lets your custom DAX format take full control.
You can also simplify and future-proof your dynamic format string like this:
VAR _currentvalue = SUM('Sales By Product Details'[Sale])
RETURN
SWITCH(
TRUE(),
_currentvalue < 1E3, "#,0",
_currentvalue < 1E6, "#,0,.0 K",
_currentvalue < 1E9, "#,0,,.0 M",
"#,0,,,.0 B"
)
This avoids overlapping format definitions and makes it easier to read and debug.
Best regards,
Hi @DataNinja777 ,
Thank you for replying so promptly! Unfortunately, changing the display units to "None" didn't work. Additionally I tried it with your code as well. No luck!
Hi @pp_123 ,
Dynamic formatting often works well in tables and matrix visuals, but can behave unexpectedly in bar or column charts – especially with complex format strings like "#,,00.,M".
Here’s what you can try:
SWITCH ( TRUE(), _currentvalue < 1E3, "#,0", _currentvalue < 1E6, "#,0.0,K", _currentvalue < 1E9, "#,0.0,,M", "#,0.0,,B" )
If you're using dynamic format strings in a measure, make sure to assign the format string in the Model view under “Format string expression”.
Alternatively, for bar charts, try setting the data label display units manually (e.g., Thousands or Millions) in the formatting pane.
If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.
translation and formatting supported by AI
@burakkaragoz
Thank you for the prompt response!
1. I am using it for a measure and have also assigned it under "Format string expression".
2. Display units have been set as "None".
Still doesn't solve the issue.
Thanks for confirming those steps — sounds like you're doing everything right on the surface. Since the dynamic format still isn't applying in the visual, here are a few deeper checks you can try:
Make sure the dynamic format string is assigned to the same measure that’s being used in the visual. Sometimes a copy or renamed version of the measure is used in the chart, and the formatting doesn’t carry over.
If the visual still ignores the format string, you can try formatting the value manually in a new measure:
Formatted Value = VAR _value = [YourMeasure] VAR _format = SWITCH ( TRUE(), _value < 1E3, "#,0", _value < 1E6, "#,0.0,K", _value < 1E9, "#,0.0,,M", "#,0,,B" ) RETURN FORMAT(_value, _format)
Then use this Formatted Value in a card or table visual to test if the formatting logic works as expected.
⚠️Note: This won't work in bar/column charts directly since they expect numeric values — but it's a good way to debug the format logic.
Sometimes visuals cache formatting. Try:
Dynamic format strings don’t always apply to data labels in visuals like bar/column charts — especially if the visual is using auto-scaling or display units. In that case, it might be a current limitation of the visual engine.
translation and formatting supported by AI
@burakkaragoz thank you so much! creating new visuals worked for me!! Thanks again!!
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
71 | |
67 | |
51 | |
39 | |
26 |
User | Count |
---|---|
87 | |
54 | |
45 | |
40 | |
36 |