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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
WV
Frequent Visitor

Dynamic Unpivot in PowerQuery

Hi,

 

I have a table populating from SharePoint list. In this table I have a set columns in a tabular format. I have added a screen shot for reference. I am trying to unpivot the data so that there is one Date column, one Capital column, one Notes column, and one Expense column. Right now there are 26 of each.  They also keep adding new SP columns so I would like it to be dynamic so it always automatically captures the new data. 

 

Here is where I have started: 

let
Source = SharePoint.Tables("http://inside/private/CAM/", [ApiVersion = 15]),
#"0cb52d41-3597-476f-b8eb-e2020540e973" = Source{[Id="0cb52d41-3597-476f-b8eb-e2020540e973"]}[Items],
#"Unpivoted Columns" = Table.Unpivot(Source, List.Select(Table.ColumnNames(Source), each (Text.StartsWith("SP") and Text.EndsWith("Date"))), "Attribute", "Value")
in
#"Unpivoted Columns"

 

BUT I am getting this error: 

Expression.Error: 1 arguments were passed to a function which expects between 2 and 3.
Details:
Pattern=
Arguments=[List]

 

I need to make a condtional unpivot saying if the column starts with SP and Ends with Date - then put that into one date column, then do the same for Expense, Notes, and Capital. 

 

WV_0-1677708878642.png

 

WV_1-1677708943423.png

 

Thank you for any and all support. 

 

 

3 REPLIES 3
lbendlin
Super User
Super User

When you unpivot you need to specify at least one fixed point - a column that does not change.

WV
Frequent Visitor

Where in the syntax would I specify that? 

 

Source = SharePoint.Tables("http://inside/private/CAM/", [ApiVersion = 15]),
#"0cb52d41-3597-476f-b8eb-e2020540e973" = Source{[Id="0cb52d41-3597-476f-b8eb-e2020540e973"]}[Items],
#"Unpivoted Columns" = Table.Unpivot(Source, List.Select(Table.ColumnNames(Source), each (Text.StartsWith("SP") and Text.EndsWith("Date"))), "Attribute", "Value")
in
#"Unpivoted Columns"

 

Thanks,

Wendy

Please provide a sample of your SP list and indicate the expected result.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.