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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
T4S3R
Helper II
Helper II

Power BI Tabular Editor - Format String Expression not calculating the same value as the Expression

Hi everyone,

 

i am currently facing a problem where I need to create a dynamic formatting in a calculation group. One decimal for values below 10 / above -10 and no decimals for everything else.

 

During development, this works like a charm for e.g. the following Expression / Format String Expression

T4S3R_5-1643880662347.png

I just use the same calculation in the format string expression and define the format based on the smaller 10, bigger -10 rule.

T4S3R_1-1643880042569.png

 

This works the same way if i just evaluate the selectedmeasure (in another calculation item):

T4S3R_2-1643880132438.png

 

Now for whatever reason, the same construct does not work for the following Format string expression:

T4S3R_3-1643880261537.png

The calculation inside the calc variable returns values when used in a expression or a measure (the measure KPI value calc used in the screenshot below is the Measure the SELECTEDMEASURE() statement has to evaluate):

T4S3R_4-1643880568954.png

 

During testing, I found out that the calculation you can see in the screenshot above returns a blank / 0 value (both statements individually have the same result) if used in a Format String Expression:

T4S3R_6-1643880973677.png

 

Now long story short, my questions:

  • Why does the same calculation return blank in a format string expression but returns the correct values in a measure or expression?
  • Why does this construct work for the first two cases, but not the third one?
  • Is there a way  around this? I need to calculate the values in the format string expression to apply the correct formatting to the values.

 

Best regards and i wish you all a nice week!

Timo

 

1 ACCEPTED SOLUTION
T4S3R
Helper II
Helper II

Hi everyone, 

 

it seems i figured out a solution. Instead of repeating the actual calculation from your Expression, you can reference the expression inside the Format String Expression:

T4S3R_1-1643972189719.png

During my testing this returns the expected result.

 

Best regards

Timo

View solution in original post

1 REPLY 1
T4S3R
Helper II
Helper II

Hi everyone, 

 

it seems i figured out a solution. Instead of repeating the actual calculation from your Expression, you can reference the expression inside the Format String Expression:

T4S3R_1-1643972189719.png

During my testing this returns the expected result.

 

Best regards

Timo

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

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.