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
Anonymous
Not applicable

Bar chart visualization for different years

Hello! 

 

I believe there should be a rather easy solution for this, but for some reason, I haven't been able to do this

I have a list of products with the launching year and the year they will be discontinued. 

I want a bar chart where my horizontal axis is the timeframe and the data being the count of products that will be launched (in one bar) and the products that will be discontinued in another bar. 

 

ProductLaunchedDiscontinued
Socks20212023
Blouse20092021
Pants20202021
Jacket20192040
Hairband20202022
T-shirt20202024
Gloves20082009

 

Does anyone have an idea on how to do this bar chart visualization? 

It will be much appreciated! 

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

You'll need a new table to use for the x-axis.

 

For example:

Years =
SELECTCOLUMNS (
    GENERATESERIES ( MIN ( Products[Launched] ), MAX ( Products[Discontinued] ) ),
    "Year", [Value]
)

This is just a list of years between 2008 and 2040.

 

Put Years[Year] on the x-axis and define your counting measures.

LaunchedCount =
CALCULATE (
    COUNTROWS ( Products ),
    Products[Launched] IN VALUES ( Years[Year] )
)

DiscontinuedCount =
CALCULATE (
    COUNTROWS ( Products ),
    Products[Discontinued] IN VALUES ( Years[Year] )
)

 

AlexisOlson_0-1636578304739.png

 

View solution in original post

3 REPLIES 3
AlexisOlson
Super User
Super User

You'll need a new table to use for the x-axis.

 

For example:

Years =
SELECTCOLUMNS (
    GENERATESERIES ( MIN ( Products[Launched] ), MAX ( Products[Discontinued] ) ),
    "Year", [Value]
)

This is just a list of years between 2008 and 2040.

 

Put Years[Year] on the x-axis and define your counting measures.

LaunchedCount =
CALCULATE (
    COUNTROWS ( Products ),
    Products[Launched] IN VALUES ( Years[Year] )
)

DiscontinuedCount =
CALCULATE (
    COUNTROWS ( Products ),
    Products[Discontinued] IN VALUES ( Years[Year] )
)

 

AlexisOlson_0-1636578304739.png

 

Anonymous
Not applicable

Hi @AlexisOlson, a quick follow-up question on this. 

How can I create a measure of "active" products per year? 

Something like the summing the total number of launched products from previous years that haven't been discontinued, and substracting the discontinued per year. 

Do I have to create a measure for each year? Or could I have a general one and then add a yearly slicer to my page? 

 

Any tip will be appreciated! 

Anonymous
Not applicable

@AlexisOlson Yes, this works perfectly!!! 

 

I was close yet so far haha 

Thanks a lot!! 

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.