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
PowerBIUser14
New Member

Beginner query on designing a chart where months are formatted as columns

I'm trying to build a chart where I can see months on the X Axis so I can see a trend over time. Then have bars representing sold products and a line representing 'received' products to identify the gap. However, Power BI is not allowing for the same, any solutions would be much appreciated. 

 

Thanks (Data Set attached below). 

 

Sold     
Product TypeProduct ColourProduct Sub ColourJanuaryFebruaryMarch
XBlueRed110
YBlueGreen001
ZGreenBlack111
      
      
Received     
Product TypeProduct ColourProduct Sub ColourJanuaryFebruaryMarch
XBlueRed111
YBlueBlack002
ZGreenRed111

 

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @PowerBIUser14 

 

The current table format is not friendly for the chart you want. You have to transform the table with Power Query Editor first to make months locate in the same column. Open Power Query Editor from Home > Transform data, then you can do the following transformation steps to both tables. 

1. Select the first three columns and choose "Unpivot Other Columns" option. (Or select all month columns and choose "Unpivot Columns", which has the same effect.)

vjingzhang_0-1674798848473.png

2. Rename the new Attribute column to "Month". Add Prefix and Suffix to this column to make it have month start date. Then change this column from Text type to Date type. 

vjingzhang_1-1674799277023.png

3. Transform the other table in the same way. Then apply the change to Power BI Desktop. 

vjingzhang_2-1674799406163.png

In Power BI Desktop, you can add a table to have all distinct month values from either of above table. And build relationships between it and Sold/Received tables on Month column. 

vjingzhang_3-1674799668418.pngvjingzhang_4-1674799829505.png

Then you can build the chart per your need. Remember to use Dim Month table's Month column on X-axis. 

vjingzhang_5-1674800134555.png

I have attached a sample file at bottom for your reference. 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

1 REPLY 1
v-jingzhang
Community Support
Community Support

Hi @PowerBIUser14 

 

The current table format is not friendly for the chart you want. You have to transform the table with Power Query Editor first to make months locate in the same column. Open Power Query Editor from Home > Transform data, then you can do the following transformation steps to both tables. 

1. Select the first three columns and choose "Unpivot Other Columns" option. (Or select all month columns and choose "Unpivot Columns", which has the same effect.)

vjingzhang_0-1674798848473.png

2. Rename the new Attribute column to "Month". Add Prefix and Suffix to this column to make it have month start date. Then change this column from Text type to Date type. 

vjingzhang_1-1674799277023.png

3. Transform the other table in the same way. Then apply the change to Power BI Desktop. 

vjingzhang_2-1674799406163.png

In Power BI Desktop, you can add a table to have all distinct month values from either of above table. And build relationships between it and Sold/Received tables on Month column. 

vjingzhang_3-1674799668418.pngvjingzhang_4-1674799829505.png

Then you can build the chart per your need. Remember to use Dim Month table's Month column on X-axis. 

vjingzhang_5-1674800134555.png

I have attached a sample file at bottom for your reference. 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

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.