Hi all,
I have a power query unpivot problem that I don’t quite know how to get around. I have multiple columns see image #1. I would like to pivot, one for dates and the other for campaigns.
The final output should be like the one image # 2.
Appreciate any direction. I saw Melissa’s content on How To Unpivot Multiple Column Pairs In Power Query but these are not in pairs. Thanks for the help.
image #1
image#2
ysherriff.pbix (3.4 MB)
Hi Yuhanna,
You could unpivot twice. Select the columns you want to unpivot and unpivot the selected columns.
I have here unpivoted 2 campaign columns and 3 date columns. You can add columns or take out columns out of the code according to your needs.
=> You will get the columns like you depicted in image#2
This code would fit below #“Removed Other Columns1” of your EDNA Test query:
...,
#"Unpivoted Only Selected Columns" = Table.Unpivot(#"Removed Other Columns1", {"martech_campaign", "most_recent_martech_campaign"}, "Attribute", "Value"),
#"Unpivoted Only Selected Columns1" = Table.Unpivot(#"Unpivoted Only Selected Columns", {"campaign_join_date", "horiginal_campaign_start_date__c", "horiginal_campaign_interaction_date__c"}, "Attribute.1", "Value.1")
in
#"Unpivoted Only Selected Columns1"
Regards,
Matthias
Thanks Matthia like always.
Best
1 Like
Glad that it was what you needed, Yuhanna!
=> You could adjust the solution post to post #2.