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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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. 

1 ACCEPTED SOLUTION
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

View solution in original post

8 REPLIES 8
v-pgoloju
Community Support
Community Support

Hi @Chxlsea_,

 

As we haven’t received any further updates and there are no outstanding queries at the moment, we’ll go ahead and close this thread for now. If you have any additional questions in the future, please don’t hesitate to start a new thread we’re always here to help.

 

Warm regards,
Prasanna Kumar

v-pgoloju
Community Support
Community Support

Hi @Chxlsea_,


Just following up to see if the suggested approach helped with applying conditional formatting specifically red and green icons to your visual calculation for Variance. Since you're working with a visual calculation rather than a DAX measure, we understand the setup might be a bit complex.

 

If you're still encountering issues or need further guidance, feel free to reach out. We’re happy to help!

 

Warm regards,
Prasanna Kumar

v-pgoloju
Community Support
Community Support

Hi @Chxlsea_,


Just checking in to see if the solution helped resolve your issue. If you still need any assistance or have further questions, feel free to reach out we’re here to help.

 

Best regards,
Prasanna Kumar

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
Responsive Resident
Responsive Resident

@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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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