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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.