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

Plotting Calculated Column Months into a stack column chart

Hello,

 

I'm a new PowerBI user who just started learning this program.

 

I'm working on a resource loading visualization that pulls data from a database and applies a function to calculate the load of each item at the particular month. I have a 12 calculated columns (Months of 2020) which I would like to plot on a line chart showing the sum of the data in each month over the year.

 

However, I can't seem to find the correct x-axis to plot this data.

 

Sorry if this has been raised, I've been searching the forums but unable to find a solution which works for me.

 

Thanks!

6 REPLIES 6
AngusTan
Frequent Visitor

Thanks everybody for the replies.

 

Unfortunately as my data is confidential I am unable to share it. I've created a dummy database in excel as shown here.

 

Capture.JPG

 

Columns A-G are fixed and queried from an online database. Columns H and beyond are my calculated columns done in Power BI,  they display the load of each project at a particular month. A project progresses along stages and naturally the load also changes. My intent is to eventually achieve a Visual where I can filter by the appropriate manager and it shows a timeline of his/her total load per month.

 

I thought I could separate the monthly loads on another table but I couldn't get it to refer to the main dataset (which contains the project stage for load calculation)

 

From what I understand from the previous advice, it seems that I need to duplicate 12 entries per Project? Wouldn't that be far too complicated?

 

Thanks again to all who had replied.

Hi @AngusTan ,

 

I'm not sure how you define "Load". For example, why the jan 2020 load in the first row is 5. Appreciate for your explanation.

 

Best regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
v-jayw-msft
Community Support
Community Support

Hi @AngusTan ,

 

Please refer to the formula below to create a calculated table.

BTW, it would be better to share some sample data to us if you don't have any Confidential Information. In that case we might be able to help you find another way instead of creating 12 calculated column.

Table 2 = 
UNION (
    SELECTCOLUMNS (
        'Table',
        "item", 'Table'[Item],
        "person", 'Table'[Person],
        "amount", 'Table'[Jan],
        "month", "Jan"
    ),
    SELECTCOLUMNS (
        'Table',
        "item", 'Table'[Item],
        "person", 'Table'[Person],
        "amount", 'Table'[Feb],
        "month", "Feb"
    )
)

 Result would be shown as below.

1.PNG

2.PNG

 

Best Regards,

Jay

Community Support Team _ Jay Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
Mariusz
Community Champion
Community Champion

Hi   @AngusTan 

 

Why not store the Months as rows instead of Columns?

Its a lot easier to handle data in this format in Power BI.

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Hey @Mariusz ,

 

Thanks for the quick reply!

 

The reason why I didn't store the months as rows is because the rows are already populated with a list of items.  I've plotted an example below.

 

Thus the intent would be to display a Column or Area Chart, showing the Total number of fruits purchased by a person per month. In Jack's case, I should be able to visualise the total number of fruits he purchased every month, over the entire year; i.e; 14 fruits in Jan, 7 Fruits in Feb and so on...

 

I can plot it using a Clustered Column chart but I am unable to format the axis labels with months as per traditional timeline charts.

 

Columns 'Item' and 'Person' are fixed and obtained from an online database, and there are several columns I used to calculate the number of fruits purchased by a particular person in a particular month (actual number of rows, additional columns not shown for simplicity).

 

Thanks!

 

ItemPersonJanFeb
AppleJack105
OrangeTom11
PearJill24
BananaJack42

Hi,

As suggested, it would still be the best layout to get all months in a single column.  We will then build a date column and a Calendar Table.  Then create a relationship from the Date column of the Data Table to the Date column of the Calendar Table.  In the Calendar Table, write calculated column formulas to extract Year and Month.  To your visual, drag Year and Month from the Calendar Table.  Write measures and then drag those to your visual.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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.