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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
MJ1986
New Member

Making each column heading an x-axis label

I have some baby name data. In the first column, I have a long list of baby names. In the subsequent columns I have every year from 1900 to 2017, with the number of babies born with each name in each year. 

 

I want to create a line graph where each name can be selected in the slicer and the graph then shows popularity of that name in each year. I can create a line graph and then a slicer with the name column dragged into the slicer. 

 

However, I'm not sure how to get the x axis to display each year from 1900 to 2017, with the corresponding data in the graph.  

 

I've attached a screenshot of the data and the potential line graph. 

 

Power BI 1.pngPower BI 2.png

1 ACCEPTED SOLUTION
Drors
Resolver III
Resolver III

I think that the easy way to handle it is to Unpivot your table :

In the query editor, select the Name column -->right click --> Unpivot other columns

Now you have table like :

jon   2010   5

jon   2011   4

jon   2012   6

 

after that in the line chart visual, put the year(attribute) in the axis feild the name in the Legend and the value in the value.

 

Hope it will solve your problem

View solution in original post

1 REPLY 1
Drors
Resolver III
Resolver III

I think that the easy way to handle it is to Unpivot your table :

In the query editor, select the Name column -->right click --> Unpivot other columns

Now you have table like :

jon   2010   5

jon   2011   4

jon   2012   6

 

after that in the line chart visual, put the year(attribute) in the axis feild the name in the Legend and the value in the value.

 

Hope it will solve your problem

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.

Top Solution Authors