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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Conversion from a Row to Multiple Columns

Hi, 

This might be extremely basic questions for the expert user. But pretty tough for me. I have tried pivoting and unpivoting, however, couldn't get throug.

 

The original Dataset

DateNameValueAnnual Increment
01-Jul-22G191
02-Jul-22G24.52
03-Jul-22G303
04-Jul-22G35.54
05-Jul-22G415
01-Jul-22O46.5null
02-Jul-22O52null
03-Jul-22O57.5null
04-Jul-22O63null
05-Jul-22O68.5null
01-Jul-22C74null
02-Jul-22C79.5null
03-Jul-22C85null
04-Jul-22C90.5null
05-Jul-22C96null

 

The Required Shape

 

DateGOCAnnual Increment
01-Jul-221946.5741
02-Jul-2224.55279.52
03-Jul-223057.5853
04-Jul-2235.56390.54
05-Jul-224168.5965

 

Thank you for your assistance.

 

Regards,
Usman

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

I created a sample pbix file(see attachment), please check if that is what you want...

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bc47DoQwDATQu7iGFfEnkHoLJJo9QJQb0HL/jS2hYIvC4+JppKkV0nxc54wIE+z9UtGANlVAL8gf0WdG3mjRMOEgYi02E2+ceojJY8VPJVsrzlASvIECrKPDnjLdIAG20XlM+PZb+WWAQRkd8rS9DVAoy+hIoGzQ/g==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, Name = _t, Value = _t, #"Annual Increment" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Name", type text}, {"Value", type number}, {"Annual Increment", Int64.Type}}),
    #"Removed Columns" = Table.RemoveColumns(#"Changed Type",{"Annual Increment"}),
    #"Pivoted Column" = Table.Pivot(#"Removed Columns", List.Distinct(#"Removed Columns"[Name]), "Name", "Value", List.Sum),
    #"Added Index" = Table.AddIndexColumn(#"Pivoted Column", "Annual Increment", 1, 1, Int64.Type)
in
    #"Added Index"

yingyinr_0-1659578411149.png

Best Regards

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi

The only way to get to your desired result is to have the Increment values in place of the nulls?  What should the logic be for plugging the increment values in the null cells?  Please clarify.


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

Hi @Anonymous ,

I created a sample pbix file(see attachment), please check if that is what you want...

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bc47DoQwDATQu7iGFfEnkHoLJJo9QJQb0HL/jS2hYIvC4+JppKkV0nxc54wIE+z9UtGANlVAL8gf0WdG3mjRMOEgYi02E2+ceojJY8VPJVsrzlASvIECrKPDnjLdIAG20XlM+PZb+WWAQRkd8rS9DVAoy+hIoGzQ/g==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, Name = _t, Value = _t, #"Annual Increment" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Name", type text}, {"Value", type number}, {"Annual Increment", Int64.Type}}),
    #"Removed Columns" = Table.RemoveColumns(#"Changed Type",{"Annual Increment"}),
    #"Pivoted Column" = Table.Pivot(#"Removed Columns", List.Distinct(#"Removed Columns"[Name]), "Name", "Value", List.Sum),
    #"Added Index" = Table.AddIndexColumn(#"Pivoted Column", "Annual Increment", 1, 1, Int64.Type)
in
    #"Added Index"

yingyinr_0-1659578411149.png

Best Regards

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors