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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anchit_Thomas
Helper I
Helper I

Color code graph with respect to trendline

Is it possible to color code the bars with respect to trendline ?

 

Red for negative trendline and green for positive trendline

 

Anchit_Thomas_0-1607351508622.png

 

Thank you

 

1 ACCEPTED SOLUTION
v-lionel-msft
Community Support
Community Support

Hi @Anchit_Thomas ,

 

Even the line and bar graphs generated using the "Analysis" function contain two metrics, but this is not important.
If you just want to change the color of the bar graph, you can do so.

Please refer to my .pbix file.

 

v-lionel-msft_1-1607666487912.png

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-lionel-msft
Community Support
Community Support

Hi @Anchit_Thomas ,

 

Even the line and bar graphs generated using the "Analysis" function contain two metrics, but this is not important.
If you just want to change the color of the bar graph, you can do so.

Please refer to my .pbix file.

 

v-lionel-msft_1-1607666487912.png

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-lionel-msft
Community Support
Community Support

Hi @Anchit_Thomas ,

 

Unfortunately, there is no way to add conditional formatting on the trend line, only on the bar.

v-lionel-msft_0-1607501996777.png

Please submit your idea .

 

But if you switch the above visual to a line chart, you will get such a visual.😅

Color = 
VAR __current_value = SUM(Sales[Sale 2015])
VAR __preview_value = 
CALCULATE(
    SUM(Sales[Sale 2015]),
    FILTER( ALLSELECTED(Sales), [Rank] = MAX([Rank]) - 1 )
)
RETURN
IF(
    __current_value - __preview_value <=0,
    "Red","Green"
)

v-lionel-msft_1-1607502793769.pngv-lionel-msft_2-1607502808898.png

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

@v-lionel-msft 

 

Hi, i want to confirm one thing to make sure you understood it correctly.

 

I am only using one metric (ex: sales in your case) for bar graph. Trendline is generated using "Analytics" pane built in PBI. Trendline isnt a representation of anyother metric.

 

Requirement is color of bar to change according to growth or de-growth of trendline.

 

I can see in your image that you are using two metrics - one for bar and other for line.

 

 

Anchit_Thomas
Helper I
Helper I

@v-yiruan-msft 

 

Hi. Any solution for this ? 

Thank you very much in advance

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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