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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Chxlsea_
Regular Visitor

Apply conditional formatting to a visual calculation

Is it possible to apply conditional formatting, specifically the red and green icons, to a visual calculation. I am unable to replace the visual calculation with a DAX measure due to the complicated nature of the data. Therefore, the visual calculation "Variance" where i do Actual cost - Standard cost works better. I however would then like a column with these icons based on whether the variance is negative or positive. 

5 REPLIES 5
v-pgoloju
Community Support
Community Support

Hi @Chxlsea_,

 

Thank you for reaching out to the Microsoft Fabric Forum Community.

 

Please try creating a single visual calculation measure for Variance and apply conditional formatting using the following DAX query:

 

Color =
VAR Variance = [Actual Cost] - [Standard Cost]
RETURN
IF (Variance >= 0, "Green", "Red")

 

If the issue continues, feel free to contact us. We are here to assist you.

 

Best regards,
Prasanna Kumar

DataNinja777
Super User
Super User

Hi @Chxlsea_ ,

 

Yes, it is possible to apply conditional formatting, specifically red and green icons, to a visual calculation in Power BI. This functionality allows for more dynamic and visually intuitive reports directly within a visual, avoiding the need for complex DAX measures when dealing with intricate data models. You can achieve your goal of displaying icons based on whether your "Variance" calculation is positive or negative.

 

First, you would create your "Variance" visual calculation within your table or matrix. This is done by selecting the visual and adding a new visual calculation with a formula that subtracts the standard cost from the actual cost.

Variance = [Actual Cost] - [Standard Cost]

Once the visual calculation is created, you can apply the icon-based conditional formatting. In the "Visualizations" pane, right-click on your "Variance" visual calculation field, navigate to "Conditional formatting," and select "Icons." In the dialog box that appears, you will define the rules. For a negative variance, you can set a rule where if the value is less than 0, a red icon is displayed. You would then add a new rule for a positive variance, stating that if the value is greater than or equal to 0, a green icon should be used. After applying these rules, your visual will automatically show the corresponding icons next to your variance figures.

 

An alternative approach is to create a second visual calculation dedicated solely to generating an indicator for the icon. This keeps the numerical variance and the visual icon in separate columns. You could use a SWITCH function to output a text value like "Red" or "Green" based on the variance.

Variance Icon =
SWITCH(
    TRUE(),
    [Variance] < 0, "Red",
    [Variance] > 0, "Green",
    "Yellow"
)

With this "Variance Icon" calculation, you would then apply conditional formatting to it. Instead of using rules, you would select "Field value" as the format style and base it on the "Variance Icon" field itself. This method provides explicit control over the logic and presentation of your visual indicators, streamlining the process of creating insightful reports.

 

Best regards,

Hi, thank you however, i am not given the option to select conditional formatting when it is a visual calculation 

Chxlsea__0-1750858182589.png

 

wardy912
Resolver II
Resolver II

@Chxlsea_ 

 

 You could add another visual calculation

Variance Icon = IF([Variance] > 0, 1, IF([Variance] < 0, -1, 0))

 

Then, apply conditional formatting with icons to this new column:

 

Go to the Values section of your table/matrix.
Click the dropdown next to the new column.
Choose Conditional formatting > Icons.
Set the rules:
1 → Green up arrow
-1 → Red down arrow
0 → Yellow dash or neutral icon

Chxlsea__0-1750857638219.png

Hi, my visual calculations do not seem to allow me to conditionally format them 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.