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
RobRayborn
Helper IV
Helper IV

Format string showing negative sign (-), sometimes.

I'm using calculation groups and one is to show the growth % form previous year.
I'm using the following Fromat String to format this calculation group: VAR Output =IF( SELECTEDMEASURE() >= 0, FORMAT( SELECTEDMEASURE(), "0%" ), UNICHAR(128315) & FORMAT( SELECTEDMEASURE() , "0%; (0%)" ) )RETURN"""" & Output

 

The format string shows the positive percentage normally, ex: 20%.  When the percentage is negative there will be a red downward pointing triange then (20%), unless the negative amount is less than negative (50%).  It appears that any percentage less than (50%) the negative symbol of "-" shows up infront of the red downward triangle.
I would like to keep it consistant. If one negative amount has the "-" they all should, or they all should not.
Can the Format String be rewritten to correct this, and/or can someone explain to me why this is happening?neagive amount.png

 

2 ACCEPTED SOLUTIONS
OwenAuger
Super User
Super User

Hi @RobRayborn 

First off, to fix the issue I would suggest this format string which should give you the intended format:

"0%;" & UNICHAR ( 128315 ) & "(0%);0%"

To explain the issue:

  1. In general, a format string expression should return the format string itself, not the formatted measure value as text. (In some cases it can be useful to do this but is not needed here).
  2. If you did want to return a literal formatted value, you would need to return """" & Output """"
  3. SELECTEDMEASURE () is a reference to the underlying measure used in the visual, which is not the Growth % returned by this calculation item's expression but is rather the original measure for which you are calculating Growth %. So the logic is not correct for testing the sign of the Growth % value.

 

 


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

RobRayborn
Helper IV
Helper IV

Thank you. That worked perfectly.

View solution in original post

2 REPLIES 2
RobRayborn
Helper IV
Helper IV

Thank you. That worked perfectly.

OwenAuger
Super User
Super User

Hi @RobRayborn 

First off, to fix the issue I would suggest this format string which should give you the intended format:

"0%;" & UNICHAR ( 128315 ) & "(0%);0%"

To explain the issue:

  1. In general, a format string expression should return the format string itself, not the formatted measure value as text. (In some cases it can be useful to do this but is not needed here).
  2. If you did want to return a literal formatted value, you would need to return """" & Output """"
  3. SELECTEDMEASURE () is a reference to the underlying measure used in the visual, which is not the Growth % returned by this calculation item's expression but is rather the original measure for which you are calculating Growth %. So the logic is not correct for testing the sign of the Growth % value.

 

 


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

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.