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
Anonymous
Not applicable

Calculation group: Substraction not working with format from format string expression

Hey there!

I am creating a calculation item in tabular editor which is supposed to calculate the difference between two values:

VAR BASELINE_VALUE = CALCULATE ( SELECTEDMEASURE (), 'Version'[Version] = "V2" ) 
VAR VALUE_TO_COMPARE = CALCULATE ( SELECTEDMEASURE (), 'Version'[Version] = "V1" )
RETURN BASELINE_VALUE - VALUE_TO_COMPARE

With an Format String Expression:

SWITCH ( Numberformat[Numberformat Factor], 
1, "#,0.00\ €;-#,0.00\ €;#,0.00\ €",
1000, "#,0.00\ T€;-#,0.00\ T€;#,0.00\ T€",
1000000, "#,0.00\ M€;-#,0.00\ M€;#,0.00\ M€" )


For some reason the value does not get the "€", "T€", "M€". Can anybody help with that?


When using this instead it works:

VAR BASELINE_VALUE =
    CALCULATE ( SELECTEDMEASURE (), 'Version'[Version] = "V2" )
VAR VALUE_TO_COMPARE =
    CALCULATE ( SELECTEDMEASURE (), 'Version'[Version] = "V1" )
RETURN FORMAT ( ( BASELINE_VALUE - VALUE_TO_COMPARE ),
        SWITCH (
            Numberformat[Numberformat Factor],
            1, "#,0.00\ €;-#,0.00\ €;#,0.00\ €",
            1000, "#,0.00\ T€;-#,0.00\ T€;#,0.00\ T€",
            1000000, "#,0.00\ M€;-#,0.00\ M€;#,0.00\ M€" ) )

 
In my measure I have the Sum / Numberformat Factor.

1 REPLY 1
Anonymous
Not applicable

Hi @Anonymous 

I have a test on your sample, I think the second code will work well. Format your measure after calculation.

My easy sample:

1.pngHere is a blog about calculate group in tabular.

For reference: Introducing Calculation Groups

If this reply still couldn't help you solve your problem, please share a sample with us and show us a screenshot with the result you want.

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

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

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.