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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Rylee
Helper I
Helper I

Line Chart with Time Periods as Column Headers

I want to create a line chart showing dollar sales trend of a product over 52 weeks in a line chart. Currently, my data is formatted so the different products appear in rows, the column headers are weeks of the year, and the values of those columns are dollar sales.

 

This is how I would format my data if I was making this chart in Excel, but I can't seem to do this is BI.

 

Does anyone have a suggestion on how to do this or if it is possible?

 

Thanks! Robot Happy

1 REPLY 1
chbraun
Helper I
Helper I

Hi,

 

the format of your data should be like this for each row: product, week, sales. Once you have that building the line chart is trivial - just put week on "Axis" and sales on "Values" in the line charts configuration pane.

 

Now, in order to get from the format you have to the format I mentioned above you need to unpivot your data, i.e. pull the week values into rows in a new column. Luckily, that's a ready-made action in the "Edit query" editor - just select the columns you need to unpivot, hit a buttom - et voila, you have the data in the format you need. 🙂

 

Here's a link to a step-by-step description: Pivot and unpivot with Power BI

 

Hope this helps!

Christian

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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