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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Pallavi_m
Helper I
Helper I

Line and stacked column chart

Hi,

I have a chart like this.

 

Now, I have an year column on x-axis. 

Year

2015

2016

2017

2018

2019

2020

2021

2022

2023

2024

I have already claculated measures like total sales etc., on y-axis.

requirement: i want years 2015... 2021 to be grouped under A and coloured in grey

 and current year(2022 , 2023 ,2024 ) to be grouped under B and coloured in blue.

 

Help is appreciated

 

requirement:

1 ACCEPTED SOLUTION
Arul
Super User
Super User

@Pallavi_m ,

I hope below are your expectation.
Expected existing:

Arul_0-1670990495831.png

Expected Outcome:

Arul_1-1670990515614.png

To achieve this, you have to create a calculated column with the below code and use it in your visual.

 

Group =
IF ( Sales[Year] >= 2015 && Sales[Year] <= 2021, "A", "B" )

 

To change the colors. go to the visual format pane. Under the format pane choose columns and enable show all and change the color to grey for A and Blue for B.

Arul_2-1670990704546.png

Thanks,





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


LinkedIn


View solution in original post

3 REPLIES 3
Arul
Super User
Super User

@Pallavi_m ,

I hope below are your expectation.
Expected existing:

Arul_0-1670990495831.png

Expected Outcome:

Arul_1-1670990515614.png

To achieve this, you have to create a calculated column with the below code and use it in your visual.

 

Group =
IF ( Sales[Year] >= 2015 && Sales[Year] <= 2021, "A", "B" )

 

To change the colors. go to the visual format pane. Under the format pane choose columns and enable show all and change the color to grey for A and Blue for B.

Arul_2-1670990704546.png

Thanks,





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


LinkedIn


Hi @Arul ,

Thanks for the solution.

Group =
IF ( Sales[Year]  <= 2021 && sales[MonthNo]= Month(now()-1,
 [measure1],[measure2] )

when I wrote this Calculated column, it says circular dependency was detected.

How do I avoid this?

v-shex-msft
Community Support
Community Support

Hi @Pallavi_m,

You can write a measure formula to compaore current year and the specific year range to return color code, then you can use it on data color conditional formatting.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.