cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
laciodrom_80
Helper IV
Helper IV

Unpivoting column: problem when table is empty

Hi all,

 

I'm usign this UnpivotOtherColumn command in Power Query in a step of a table data transformation:

= Table.UnpivotOtherColumns(#"Removed Columns", {"Id", "Name", "Date", "Version"}, "Attribute", "Value")

 

No Matter when my table contains data, but if I there are no data in it, I've got this error:

Expression.Error: The argument value isn't valid.
Details:
[List]

 

How could I avoid this error when the table is empty?


Thanks a lot in advance for any clue!

Luca
1 ACCEPTED SOLUTION
wdx223_Daniel
Super User
Super User

= if Table.IsEmpty(#"Removed Columns") then #table({"Id", "Name", "Date", "Version","Attribute", "Value"},{}) else Table.UnpivotOtherColumns(#"Removed Columns", {"Id", "Name", "Date", "Version"}, "Attribute", "Value")

View solution in original post

1 REPLY 1
wdx223_Daniel
Super User
Super User

= if Table.IsEmpty(#"Removed Columns") then #table({"Id", "Name", "Date", "Version","Attribute", "Value"},{}) else Table.UnpivotOtherColumns(#"Removed Columns", {"Id", "Name", "Date", "Version"}, "Attribute", "Value")

View solution in original post

Helpful resources

Announcements
Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Top Solution Authors