Forum Discussion
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
I just use the same calculation in the format string expression and define the format based on the smaller 10, bigger -10 rule.
This works the same way if i just evaluate the selectedmeasure (in another calculation item):
Now for whatever reason, the same construct does not work for the following Format string expression:
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):
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:
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
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:
During my testing this returns the expected result.
Best regards
Timo
1 Reply
- T4S3RHelper 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:
During my testing this returns the expected result.
Best regards
Timo