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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
PowerConsumer21
Frequent Visitor

Creating measure for stacked bar chart

Hello, I'm having trouble creating a measure, example table below. Third column is irrelevent but might help understanding so I included it. I'm creating a stacked bar chart to display companies and make them stand out for that year if it was newly established. Out of all companies that published a game on 2011, Company A would stand out (Like a different color at the end) as it was the first initial launch alongside any other companies that published a game in that year. Any subsequent years, Company A would not stand out as it has existed since 2011. Thank you in advance!

 Year (Date column) 
Company A2011Game A
Company A2012Game B
Company A2013Game C
Company A2015Game D
Company B2013Game E
Company C2014Game F
Company C2015Game G
1 ACCEPTED SOLUTION
vanessafvg
Super User
Super User

you could do something like this

create a flag for the first years

 

IsNewYear =
 var com = SELECTEDVALUE('New Company'[Company])
 var yr= CALCULATE(MIN('New Company'[Date]), all('New Company'), 'New Company'[Company] = com)
 var dte = SELECTEDVALUE('New Company'[Date])
 return if(dte = yr, 1,0)
 
and then do some conditional formatting on the chart when the value is =1

vanessafvg_0-1687467995563.png

vanessafvg_1-1687468067772.png

 

 





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
vanessafvg
Super User
Super User

you could do something like this

create a flag for the first years

 

IsNewYear =
 var com = SELECTEDVALUE('New Company'[Company])
 var yr= CALCULATE(MIN('New Company'[Date]), all('New Company'), 'New Company'[Company] = com)
 var dte = SELECTEDVALUE('New Company'[Date])
 return if(dte = yr, 1,0)
 
and then do some conditional formatting on the chart when the value is =1

vanessafvg_0-1687467995563.png

vanessafvg_1-1687468067772.png

 

 





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




yep you could just drag the measure like i have here

 

vanessafvg_0-1687541684760.png

 





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Thank you for the reply! Would there be any way to display it on the same column? If multiple companies are in the same year, just the ones that published for the first time needs to be a different color.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.