Dynamic Unpivoting in Power Query

TheHack22

Board Regular
Joined
Feb 3, 2021
Messages
121
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
Hi All,

I'm very new to Power Query and DAX. I have a data set - a daily report that I'm trying to unpivot dynamically. The anchor columns A&B will never change. However, from columns C, these are daily reports a day (New Date will be added as Column Headers Plus the data (values) for those dates) will be added every time I add new data. How do I dynamically capture these new dates that will be added daily? I found this DAX online, but it's giving an error where there is the word "attribute". Can someone please help me to solve this?



let Source = Excel.CurrentWorkbook(){[Name=„ProductPlan“]}[Content],

Cols = Table.ColumnNames(Source),

ColsUnPivot=List.Skip(Cols, 1),

Unpivot = Table.Unpivot(Source,ColsUnPivot,„Attribute“,„Value“)

in

Unpivot



Imran_Isshack_1-1628607083390.png
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Try

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="ProductPlan"]}[Content],
    Unpivot = Table.UnpivotOtherColumns(Source, {"Segment", "Key"}, "Attribute", "Value")
in
    Unpivot
 
Upvote 0
Solution
Try

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="ProductPlan"]}[Content],
    Unpivot = Table.UnpivotOtherColumns(Source, {"Segment", "Key"}, "Attribute", "Value")
in
    Unpivot
@Bo_Ry

Thanks very much. This works perfectly. You're the best. :)
Imran
 
Upvote 0
I switched the solution post as it was also confirmed.

@Imran_IsshackNY: In the future, please mark the post that worked perfectly and naturally answered your question, not your last post unless you post your own question.
Thanks for your note. I'm still learning how to use this site. Will do so in future posts.
Imran
 
Upvote 0
Now you selected my post as the answer, so still not quite right, but that's ok.

For your future questions, you just need to mark the post that answered your question, which was #2 in this thread. I already switched the marked solution for this thread, so there is no further action is necessary for this question.

Will do so in future posts.
Thanks. It helps future readers if we do so.
 
Upvote 0
Now you selected my post as the answer, so still not quite right, but that's ok.

For your future questions, you just need to mark the post that answered your question, which was #2 in this thread. I already switched the marked solution for this thread, so there is no further action is necessary for this question.


Thanks. It helps future readers if we do so.
This is weird. It's showing the #2 mark as the solution on my end.
 
Upvote 0

Forum statistics

Threads
1,215,036
Messages
6,122,794
Members
449,095
Latest member
m_smith_solihull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top