Forum Discussion
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 A | 2011 | Game A |
| Company A | 2012 | Game B |
| Company A | 2013 | Game C |
| Company A | 2015 | Game D |
| Company B | 2013 | Game E |
| Company C | 2014 | Game F |
| Company C | 2015 | Game G |
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
3 Replies
- vanessafvgCommunity Champion
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- PowerConsumer21Frequent Visitor
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.
- vanessafvgCommunity Champion
yep you could just drag the measure like i have here