Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Fusilier2
Helper V
Helper V

Help with dynamic format strings

Hope somebody can point me in the right direction regarding dynamic formatting.

I have this table:

 

PeriodKPI CodeKPI valueData Type
    
Jun-24PC0082.12Number
    
May-24PC0081.35Number
    
Apr-24PC0081.54Number
    
Sep-25PC0051Percentage
    
Aug-25PC0051Percentage
    
Jul-25PC0051Percentage
    
Jun-25PC0051Percentage
    
May-25PC0051Percentage
    
Apr-25PC0050.98Percentage
    
Mar-25PC0050.963Percentage
    
Feb-25PC0050.94Percentage
    
Jan-25PC0050.93Percentage
    
Dec-24PC0051Percentage

I want to format KPI value as % if Data type is 'Percentage', whole number if Data type is number and show each KPI in line charts like this:

number.pngpercentage.png

Can this be achieved in dynamic format strings or is there a better way to go?

 

Thanks for any pointers!

8 REPLIES 8
Fusilier2
Helper V
Helper V

Looks like what I want to do is not possible. All of my numbers are decimal when they are loaded into Power Query. The only way of determining which one's need to be displayed as a % and which as a whole number, is by referencing the 'Data type' column. There doesn't seem to be a way of using format strings that reference other columns. So, at the moment there is no solution to this. Thanks for everybodies help though.

Hello agian @Fusilier2 ,

 

I'm glad you found a solution and were able to resolve the query. Thank you very much for sharing your findings here. It’s helpful for others facing a similar issue.

If you have any further queries, please don’t hesitate to reach out.

Thankyou for connecting with Microsoft Community Forum

ryan_mayu
Super User
Super User

@Fusilier2 

have you tried set up dynamics formatting for measures?

 

https://learn.microsoft.com/en-us/power-bi/create-reports/desktop-dynamic-format-strings?wt.mc_id=DP...

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




I've had a look at the article but I can't work out if it is possible to add in an IF statement for the format.

For example

IF(DataType = "Percentage", "0.0%", 

IF(DateType = "Number", "0.0"

 

Or similar.

@Fusilier2 

we also have format function. Does this work for you?

FORMAT function (DAX) - DAX | Microsoft Learn

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi  @Fusilier2 ,

 

You can achieve what you’re describing by using dynamic format strings for measures in Power BI. The approach is to let the format adjust automatically based on the data type in your model, so when the value represents a percentage, it displays with a % sign, and when it’s a plain number, it appears without it. To do this, first create a measure for your KPI value and then open the Measure tools pane to set up a dynamic format string using an expression. For example, you can use a DAX expression that checks the data type and switches the format accordingly, something like: if the data type is Percentage, return 0.0%; if it’s Number, return 0.0; otherwise, use a general format. Once you apply this, the same measure will automatically show the correct format for each KPI in your line chart without the need for multiple visuals or manual formatting. You can find more details in the official documentation on dynamic format strings for measures, which walks through this setup step by step.


Thank you.

 

Hi @Fusilier2 ,

 

I wanted to follow up and see if you had a chance to review the information shared. If you have any further questions or need additional assistance, feel free to reach out.

Thank you.

Hi @Fusilier2 ,

 

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.

Thank you.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors