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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
akarca
Frequent Visitor

Create table from another table

Hello, I have a table below. I would like to sum monthly volume base and create a new table with the horizontal month columns.

 

ProductVolume(kg)Date
A96.01.2022
A1091,9755.02.2022
B14095.01.2022
C10964,162.02.2022
D3032,645.01.2022
B12130,565.01.2022
C12597,126.01.2022
D466,566.03.2022
A1382,46.04.2022
C2822,46.08.2022
A637220.10.2022
D280820.09.2022
A3893,7620.11.2022
B1290,245.11.2022
B1612,85.11.2022

 

 

Ekran görüntüsü 2023-01-16 104236.jpg

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @akarca ,

I have created a simple sample, please refer to my pbix fiel to see if it helps you.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bY8xDsIwDEXvkgkkS7GdxElGoAdgYqk6IEAMgCqh9v4kLW1DxeDBfnrfdl2r47u99pdOgTq1z/512zzu29RU5+6mGqjVLjUxFSOzJi3zkDASRO8mxtoNbJ+ZxcIZ54fREQski8MDq9LAoGEQu9aGOCaD4ORvJLvogXh9Yo60IoVlyuNNYJh32S/JeRy4IKFwxPhlC2rGeQ8HDBOJE8iKCdGAX+6mCY5fRQS2BSw+FmIIv6j5AA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"(blank)" = _t, #"(blank).1" = _t, #"(blank).2" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"(blank)", type text}, {"(blank).1", type text}, {"(blank).2", type text}}),
    #"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
    #"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"Product", type text}, {"Volume(kg)", Int64.Type}, {"Date", type date}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type1", "Custom", each Date.MonthName([Date])),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Date"}),
    #"Pivoted Column" = Table.Pivot(#"Removed Columns", List.Distinct(#"Removed Columns"[Custom]), "Custom", "Volume(kg)", List.Sum)
in
    #"Pivoted Column"

vpollymsft_0-1673922253797.png

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Polly

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

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


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

Hi @akarca ,

I have created a simple sample, please refer to my pbix fiel to see if it helps you.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bY8xDsIwDEXvkgkkS7GdxElGoAdgYqk6IEAMgCqh9v4kLW1DxeDBfnrfdl2r47u99pdOgTq1z/512zzu29RU5+6mGqjVLjUxFSOzJi3zkDASRO8mxtoNbJ+ZxcIZ54fREQski8MDq9LAoGEQu9aGOCaD4ORvJLvogXh9Yo60IoVlyuNNYJh32S/JeRy4IKFwxPhlC2rGeQ8HDBOJE8iKCdGAX+6mCY5fRQS2BSw+FmIIv6j5AA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"(blank)" = _t, #"(blank).1" = _t, #"(blank).2" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"(blank)", type text}, {"(blank).1", type text}, {"(blank).2", type text}}),
    #"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
    #"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"Product", type text}, {"Volume(kg)", Int64.Type}, {"Date", type date}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type1", "Custom", each Date.MonthName([Date])),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Date"}),
    #"Pivoted Column" = Table.Pivot(#"Removed Columns", List.Distinct(#"Removed Columns"[Custom]), "Custom", "Volume(kg)", List.Sum)
in
    #"Pivoted Column"

vpollymsft_0-1673922253797.png

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Polly

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

akarca
Frequent Visitor

Hello @Samarth_18 , because I will use these tables columns in other tables. Also, I will create different columns like this. 

Samarth_18
Community Champion
Community Champion

Hi @akarca ,

 

Do you really need a seperate table since you can achieve this using Matrix Visual  by keeping the column as below:-

Samarth_18_0-1673859989386.png

 

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Kudoed Authors