Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello,
I have a Bars + Line visual.
Bars = Monthly Income
Line = Monthly Target Income
I want to conditional-format the valuse of the line, so if it is over the Bar-value it will be Red and in it is under the Bar-value it will be Green
Other option is to conditional-format the Bars color (if it is over the Line-value it will be Green and in it is under the Line-value it will be Red)
Solved! Go to Solution.
Hi @RafaelAri
Power BI doesn't offer direct conditional formatting for individual data points within a combined Bars + Line chart.
But you can try these:
1: Dual Lines with Conditional Formatting
Target Difference = VAR Target = SELECTEDVALUE('YourTable'[Monthly Target Income]) VAR Income = SELECTEDVALUE('YourTable'[Monthly Income]) RETURN IF(Target > Income, Target, BLANK())
This formula will return the target value only if it's greater than the income value. Otherwise, it will return a blank value.
Add Dual Lines: Add two lines to your chart:
Conditional Formatting for Target Line: Apply conditional formatting to the original "Monthly Target Income" line. Set the line color to red when the value is greater than the corresponding value in the "Monthly Income" bar.
Filtering the Target Difference Line: For the "Target Difference" line, use a filter to only show non-blank values. This will ensure the line only appears when the target is above income, appearing red alongside the bar.
2: Dual Bars with Conditional Formatting
Duplicate the Bar Field: Duplicate the "Monthly Income" field in your data model.
Create Calculated Column: Create a calculated column using DAX:
Income Difference = VAR Target = SELECTEDVALUE('YourTable'[Monthly Target Income]) VAR Income = SELECTEDVALUE('YourTable'[Monthly Income]) RETURN IF(Target < Income, Income, BLANK())
This formula will return the income value only if it's greater than the target value. Otherwise, it will return a blank value.
Add Dual Bars: Add two bars to your chart:
Conditional Formatting for Income Bar: Apply conditional formatting to the original "Monthly Income" bar. Set the bar color to green when the value is greater than the corresponding value in the "Monthly Target Income" line.
Filtering the Income Difference Bar: For the "Income Difference" bar, use a filter to only show non-blank values. This will ensure the bar only appears when the income is above target, appearing green alongside the line.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Happy to help!
Thank you very much @Shivu-2000 ,
"Conditional Formatting for Income Bar: Apply conditional formatting to the original "Monthly Income" bar. Set the bar color to green when the value is greater than the corresponding value in the "Monthly Target Income" line"
But I don't have an option to compare Fields:
Hello,
To achieve conditional formatting based on your described conditions in Power BI, you can follow these steps:
Edit Your Visual:
Conditional Formatting for the Line:
Set Conditional Formatting Rules:
Conditional Formatting for the Bars:
Apply and Adjust:
By setting up these conditional formatting rules, you can dynamically color-code your Bars and Line visual based on the relationship between Monthly Income and Monthly Target Income as per your specified conditions.
Hi @RafaelAri
Power BI doesn't offer direct conditional formatting for individual data points within a combined Bars + Line chart.
But you can try these:
1: Dual Lines with Conditional Formatting
Target Difference = VAR Target = SELECTEDVALUE('YourTable'[Monthly Target Income]) VAR Income = SELECTEDVALUE('YourTable'[Monthly Income]) RETURN IF(Target > Income, Target, BLANK())
This formula will return the target value only if it's greater than the income value. Otherwise, it will return a blank value.
Add Dual Lines: Add two lines to your chart:
Conditional Formatting for Target Line: Apply conditional formatting to the original "Monthly Target Income" line. Set the line color to red when the value is greater than the corresponding value in the "Monthly Income" bar.
Filtering the Target Difference Line: For the "Target Difference" line, use a filter to only show non-blank values. This will ensure the line only appears when the target is above income, appearing red alongside the bar.
2: Dual Bars with Conditional Formatting
Duplicate the Bar Field: Duplicate the "Monthly Income" field in your data model.
Create Calculated Column: Create a calculated column using DAX:
Income Difference = VAR Target = SELECTEDVALUE('YourTable'[Monthly Target Income]) VAR Income = SELECTEDVALUE('YourTable'[Monthly Income]) RETURN IF(Target < Income, Income, BLANK())
This formula will return the income value only if it's greater than the target value. Otherwise, it will return a blank value.
Add Dual Bars: Add two bars to your chart:
Conditional Formatting for Income Bar: Apply conditional formatting to the original "Monthly Income" bar. Set the bar color to green when the value is greater than the corresponding value in the "Monthly Target Income" line.
Filtering the Income Difference Bar: For the "Income Difference" bar, use a filter to only show non-blank values. This will ensure the bar only appears when the income is above target, appearing green alongside the line.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Happy to help!
User | Count |
---|---|
75 | |
75 | |
45 | |
31 | |
27 |
User | Count |
---|---|
99 | |
89 | |
52 | |
48 | |
46 |