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
Field-smith
New Member

How do I get a single graph showing trend lines for each month

I am trying to create a graph which displays number of vendors selling x number of units in separate lines to show how sales are changing monthly. I can't get the data to display in a single graph, power bi keeps splitting it off into individual gaphs. Units sold on the X axis and number of vendors on the y axis.

 

I have the following data of units sold by number of vendors each month:

Units SoldAPRMARFEB
0000
30900764714575605772
606421100
90225330
120111230
150107150
18088170

 

Can anyone advise how to get this to display as a single graph with separate lines for each month? All help is appreciated, thanks.

2 ACCEPTED SOLUTIONS
Joe_Barry
Super User
Super User

Hi @Field-smith 

 

Is the data in your table formatted as a Pivot as you are showing it? You can create separate measures, but it isn't sustainable. You will need to unpivot your data. What is the Units Sold column? Are these the type of units or is it a range? I will ignore this column for the moment.

 

In Power Query. Please do the following

 

  • Highlight all Month columns
  • Right click on any of them and choose unpivot
  • You should be left with Three columns. "Units Sold", "Attribute" and "Value". You can rename these if you wish
  • You will need to create a date column. Add a custom column. 

 

if [Attribute] = "Jan" then 01/01/2024 else
if [Attribute] = "Feb" then 01/02/2024 else
if [Attribute] = "Mar" then 01/03/2024 else .....Finish for the year​

 

  • If you have a year column in your data then change the code to

 

if [Attribute] = "Jan" then "01/01/" & TextFrom.Number([Year])​

 

  • Convert to date
  • Load the data into the report
  • Create a line graph visual add the new date column to the X axis field and the Values column to the Values field

You can build out your date to Months, Year etc.. There is plenty of documenation online to show you how to do this

 

Hope this helps

Joe




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Learn about the Star Schema, it will solve many issues in Power BI!

Date tables help! Learn more



LinkedIn


Let's connect on LinkedIn


View solution in original post

Uzi2019
Super User
Super User

Hi @Field-smith 
Do you want something like this??

Uzi2019_0-1718281373803.png

 

 

 

You have to pivot your table so that all your month will come under single column.

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

View solution in original post

2 REPLIES 2
Uzi2019
Super User
Super User

Hi @Field-smith 
Do you want something like this??

Uzi2019_0-1718281373803.png

 

 

 

You have to pivot your table so that all your month will come under single column.

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!
Joe_Barry
Super User
Super User

Hi @Field-smith 

 

Is the data in your table formatted as a Pivot as you are showing it? You can create separate measures, but it isn't sustainable. You will need to unpivot your data. What is the Units Sold column? Are these the type of units or is it a range? I will ignore this column for the moment.

 

In Power Query. Please do the following

 

  • Highlight all Month columns
  • Right click on any of them and choose unpivot
  • You should be left with Three columns. "Units Sold", "Attribute" and "Value". You can rename these if you wish
  • You will need to create a date column. Add a custom column. 

 

if [Attribute] = "Jan" then 01/01/2024 else
if [Attribute] = "Feb" then 01/02/2024 else
if [Attribute] = "Mar" then 01/03/2024 else .....Finish for the year​

 

  • If you have a year column in your data then change the code to

 

if [Attribute] = "Jan" then "01/01/" & TextFrom.Number([Year])​

 

  • Convert to date
  • Load the data into the report
  • Create a line graph visual add the new date column to the X axis field and the Values column to the Values field

You can build out your date to Months, Year etc.. There is plenty of documenation online to show you how to do this

 

Hope this helps

Joe




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Learn about the Star Schema, it will solve many issues in Power BI!

Date tables help! Learn more



LinkedIn


Let's connect on LinkedIn


Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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
Top Kudoed Authors