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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
brianhackett5
Helper I
Helper I

Formatting Variable

HIguys, 

 

Just wondring if is possible to format variables depending on the result returned. I've highighted the desired format for each variable in red. 

 

Thanks in advance for your help. 

 

TOTALS =
VAR
       Price_List_Errors = FINANCIAL_KPIs_Link[PRICE LIST ERRORS]   Whole number
VAR
       Sales = FINANCIAL_KPIs_Link[SALES FIGURE]                             Currency (€)
VAR
       GP = FINANCIAL_KPIs_Link[GROSS PROFIT]                               %

RETURN


SWITCH(FINANCIAL_KPIs_Link[NUMBER],
       1, Price_List_Errors,

       2, Sales,
       3, GP)

1 ACCEPTED SOLUTION
vik0810
Resolver V
Resolver V

Yes, you can use FORMAT function.

 

SWITCH(FINANCIAL_KPIs_Link[NUMBER],
       1, FORMAT ( [Price_List_Errors], "#,##" ),
       2,  FORMAT ( [Sales], "#,##0 €" ),
       3, FORMAT(GP, "percent")
)

View solution in original post

4 REPLIES 4
brianhackett5
Helper I
Helper I

Thank you very much, that worked perfectly. 

 

Is it possible to apply conditional formatting to individual variables (Red for bad, green for good)

Hi @brianhackett5,

Have you resolved your issue? If you have, please mark the right reply as answer, so more members benefit more from here. As the @vik0810 said, we can't add the conditional formatting directly, please try the solution he shared. And please feel free to ask if you have other issue.

Best Regards,
Angelia

Not directly. But you can use 2 cards and lay them one over the other. One is formatted to text red and bound to the measure like

IF(Variable < 0, Variable, BLANK())

 and the other card hast text green and the measure is vice versa

 

IF(Variable >= 0, Variable, BLANK())
vik0810
Resolver V
Resolver V

Yes, you can use FORMAT function.

 

SWITCH(FINANCIAL_KPIs_Link[NUMBER],
       1, FORMAT ( [Price_List_Errors], "#,##" ),
       2,  FORMAT ( [Sales], "#,##0 €" ),
       3, FORMAT(GP, "percent")
)

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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