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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors