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
andreako
Frequent Visitor

Line & Stacked Column Chart, with more than 1 line shown

Hello,

 

I'm trying to create a report that compares monthly production plan for a yearly basis, with total sales forecast and total inventory stock balance for every month.  The total sales forecast and total balance is plotted in the line, and the column is the production plan for every part code.

 

Below is the current chart plotted using Excel for more information which need to achieve :

Current Source Data in ExcelCurrent Source Data in Excel

Based on the above source data, the chart is plotted as following:-

Current Chart using Ms ExcelCurrent Chart using Ms Excel

 

Using PowerBI Desktop, import raw data from excel and after some massage, able to prepare source table as following:-

Source Data @ PowerBI DesktopSource Data @ PowerBI Desktop

Due to the raw data do not have period indicated, hence prepare another set of data to indicate mth01 is Jan2018. This is to ensure everytime i can just maintain the correct period in the excel and information can be refreshed easily.

PeriodPeriod

 

My current chart @ Power BI, not really reflecting what i need. I am not sure is it because the source data preparation issue or it is not possible to replace my current chart using power BI.

 

Chart @ PowerBIChart @ PowerBI

Problem of Chart in Power BI

1. How to change those different partcode under one column, from column mth01 to column mth12?

2. How the total sales and total balance should be presented in table, so that i will only get 2 lines? ( currently, if choose all the period, all the 12 lines will be shown)

3. How to change mth01 to Jan'18 based on the period file i maintain?

 

I have upload my pbix  here, for you to get better understanding on how those data structure looks like.  

Any help or advice is very much appreciate here!

 

Thank you in advance.

 

Andrea Ko

1 ACCEPTED SOLUTION
v-yuta-msft
Community Support
Community Support

Hi andreako,

 

Can't achieve your raw data so i input a simpler sample table like below.

1.PNG 

To achieve your requirement, you can click Query Editors->Transform->Click on Mth01~Mth02->Unpivot Columns, the result will be like below:

2.PNG  

After applied&close, you can create a stack&line chart, drag [Month] column to Shared axis field, [Part Code] column to column series field, [Values] column to column values and line values field with sum aggregation.

3.PNG 

 

Please check if it can meet your requirement.

 

Regards,

Jimmy Tao

View solution in original post

4 REPLIES 4
v-yuta-msft
Community Support
Community Support

Hi andreako,

 

Can't achieve your raw data so i input a simpler sample table like below.

1.PNG 

To achieve your requirement, you can click Query Editors->Transform->Click on Mth01~Mth02->Unpivot Columns, the result will be like below:

2.PNG  

After applied&close, you can create a stack&line chart, drag [Month] column to Shared axis field, [Part Code] column to column series field, [Values] column to column values and line values field with sum aggregation.

3.PNG 

 

Please check if it can meet your requirement.

 

Regards,

Jimmy Tao

Hi Jimmy, 

 

Really appreciate of your advice, it's works great! 

Sorry abt the original source file, attached again : 

Report

 

I have further question, if you can help me with it.

 

How to change the "Period" according from Jan to Dec? 

Capture11.PNG 

Hi andreako,

 

"How to change the "Period" according from Jan to Dec?"

<--- Could you give more details about your requirement?

 

Regards,

Jimmy Tao

Dear Jimmy,

 

Deeply appreciate on the help that given to me.

All my previous problem being solved.

 

With the new problem, I have further upload my latest report (Report PBIX) with the source file

 

I wish to Sort the column by Jan 2018 until Dec 2018, so if now i sort the Period, it will follow alphabetical order.

Eg,

Sort by PeriodSort by Period 

In the Period.xls i have tried a few maintenance, current upload pbix is based on Format A.

Target to show in the chart is MMM-YY format.

 

I ever tried the FormatB, the sorting is correct from Jan ~ Dec, but how i change to wording like Jan 2018?

As for Format C, it becomes a date format, but i would to have only MMM-YY without the day,

Key

Period

(FormatA)

YYYYMM

(FormatB)

MMM-YY(FormatC)

Mth01Jan'18201801Jan-18
Mth02Feb'18201802Feb-18
Mth03Mar'18201803Mar-18
Mth04Apr'18201804Apr-18
Mth05May'18201805May-18
Mth06Jun'18201806Jun-18
Mth07Jul'18201807Jul-18
Mth08Aug'18201808Aug-18
Mth09Sep'18201809Sep-18
Mth10Oct'18201810Oct-18
Mth11Nov'18201811Nov-18
Mth12Dec'18201812Dec-18

 

Sorry for the long winded explanation, just to share what other options which being tried but still cannot get the ultimate aim.

Thank you in advance.

 

Andrea Ko

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.