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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
KH11NDR
Helper IV
Helper IV

Unpivot only selected columns not working

Hi Guys,

 

I'm editing a query (table) which I've loded in from SQL and it allows me to Unpivot only selected columns and I'll rename the two columns as date and values.  But when i press close and apply, it doesn't apply the changes and says "The column 'first column' of the table wasn't found".

 

I have no problem in doing the same thing with data loaded in from excel.

 

Thanks guys.

9 REPLIES 9
PattemManohar
Community Champion
Community Champion

@KH11NDR Please post the sample data to replicate your issue and also helpful to resolve the issue quicker...





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




@PattemManohar

 

Project ID4291742948429794300943040430704310143132431604319143221
100000963.563.553.570.576.5
22839515750434634500

@KH11NDR Thanks for that... What is your expected ouput, please...





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




This data is loaded via SQL 

 

let
Source = Sql.Databases("xxx"),

 

#"Pxxxxxx" = Source{[Name="xxxx"]}[Data],


#"dbo_'xxx$'" = #"xxxxxx"{[Schema="dbo",Item="'xxxxx$'"]}[Data],


#"Changed Type" = Table.TransformColumnTypes(#"dbo_'xxxx$'",{{"01/07/2017", type number}, {"01/08/2017", type number}, {"01/09/2017", type number},

{"01/10/2017", type number}, {"01/11/2017", type number}, {"01/12/2017", type number}, {"01/01/2018", type number}, {"01/02/2018", type number}, {"01/03/2018",

type number}, {"01/04/2018", type number}, {"01/05/2018", type number}, {"01/06/2018", type number}, {"01/07/2018", type number}, {"01/08/2018", type number},

{"01/09/2018", type number}, {"01/10/2018", type number}, {"01/11/2018", type number}, {"01/12/2018", type number}, {"01/01/2019", type number}, {"01/02/2019", type number},

{"01/03/2019", type number}, {"01/04/2019", type number}, {"01/05/2019", type number}, {"01/06/2019", type number}, {"01/07/2019", type number}, {"01/08/2019", type number},

{"01/09/2019", type number}, {"01/10/2019", type number}, {"01/11/2019", type number}, {"01/12/2019", type number}}),


#"Unpivoted Only Selected Columns" = Table.Unpivot(#"Changed Type", {"01/07/2017", "01/08/2017", "01/09/2017", "01/10/2017", "01/11/2017", "01/12/2017", "01/01/2018",

"01/02/2018", "01/03/2018", "01/04/2018", "01/05/2018", "01/06/2018", "01/07/2018", "01/08/2018", "01/09/2018", "01/10/2018", "01/11/2018", "01/12/2018", "01/01/2019", "01/02/2019",


"01/03/2019", "01/04/2019", "01/05/2019", "01/06/2019", "01/07/2019", "01/08/2019", "01/09/2019", "01/10/2019", "01/11/2019", "01/12/2019"}, "Attribute", "Value"),


#"Renamed Columns" = Table.RenameColumns(#"Unpivoted Only Selected Columns",{{"Attribute", "Dates"}, {"Value", " Values"}})
in
#"Renamed Columns"

 

 

 

 

Project IDDateValues
101/07/20170
101/08/20170
101/09/20170
101/10/20170
101/11/20170
101/12/20179
101/01/201863.5
101/02/201863.5
101/03/201853.5
101/04/201870.5
101/05/201876.5
201/07/201728
201/08/201739
201/09/201751
201/10/201757
201/11/201750
201/12/201743
201/01/201846
201/02/201834
201/03/20185
201/04/20180
201/05/20180

 

I know how to do it, but I'm getting the following message when I try to close and apply

 

"The column 'first column' of the table wasn't found".

@KH11NDR Not sure, why it's happening...  But I am successfully unpivot the same without any issues..

 

image.png





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




Are you using the data via SQL or Excel? can you share your Power BI file?

 

Thanks

 

I think mine might be a data type issue.

Reloaded the data and worked fine.................................Friday gremlings.

@KH11NDR,

 

Glad to hear that. You may help accept the solution above. Your contribution is highly appreciated.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-chuncz-msft

 

I haven't accepted a solution because there wasn't a solution given.  I understand @PattemManohar has been very helpful, but that wasn't the soloution as I already know how to pivot the table how I wanted it, My problem was the data wasn't loading with the pivoted columns, so it would be wrong for me to say that was the soloution when it wasn't and save people from trying it.  But for @PattemManohar great help, i have given  @PattemManohar a tick for thanks.

 

I hope you understand my reasons for not accepting a solution.

 

My solution was to reload the data from scratch and it worked.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.