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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
aramirez7
Frequent Visitor

Simple steps not supported in Direct Query - Postgres

Hi all,

 

For our reports in Direct Query we used to perform simple transformation in Power Query which did not break the query folding such as renaming, filtering, add new columns (simple columns).

 

Today the query folding is breaking because of Table.RenameColumns . We don't understand why? all of our reports used to support these simple transformations.

 

aramirez7_0-1612204715123.png

 

aramirez7_1-1612204791648.png

 

We are using Postgres as Datasource!

 

Please help 😥

 

1 ACCEPTED SOLUTION

I just had a call with Microsoft support, we don't understand why it stopped working but we found a way to work around this query folding breaking.

 

I changed my M code from:

 

//This code was breaking the folding

let
Source = PostgreSQL.Database(Server, DataBase),
dbo = Source{[Schema="public",Item="gl_summary_union"]}[Data],
#"Renamed Columns" = Table.RenameColumns(dbo,{{"YEAR(b.GL_TRXN_CRTD_DATE)", "Year"}})
in
#"Renamed Columns"

 

========================

 

To this:

 

//This code allows Power Bi to fold the query

 

let
Source = Value.NativeQuery(PostgreSQL.Database(Server, DataBase), "SELECT * FROM public.gl_summary_union", null, [EnableFolding=true]),
#"Renamed Columns" = Table.RenameColumns(Source,{{"YEAR(b.GL_TRXN_CRTD_DATE)", "Year"}})
in
#"Renamed Columns"

 

 

The weird thing is that the first code worked for a couple of months!

 

Thanks @vanessafvg  for your help.

Have a great day

 

Alejandro 

 

View solution in original post

7 REPLIES 7
vanessafvg
Community Champion
Community Champion

when you use direct query I am assuming power bi interpret that as your model is fully the way you want it to be.

 

Rather than doing a table rename in power query, why dont you use a sql statement and rename your columns in that statement?





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Hey  @vanessafvg Thanks for getting back to me..

 

Well, we don't want to write SQL statements - We already have a lot of reports created using M for simple transformations. It was working fine last week, Power Bi was able to create native queries for those simple transformations.

have you had a software update in the last week?  What has changed?





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Actually, I don't recall when I did the update -  but yes I am using the last version (December)

ok so I am just trying to understand the problem.

 

You were renaming columns in power query before now but suddenly today it started breaking.

 

Something needs to have changed?  Were you delayed in noticing after the last update?  Otherwise what created this problem when it was fine before?





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




I just had a call with Microsoft support, we don't understand why it stopped working but we found a way to work around this query folding breaking.

 

I changed my M code from:

 

//This code was breaking the folding

let
Source = PostgreSQL.Database(Server, DataBase),
dbo = Source{[Schema="public",Item="gl_summary_union"]}[Data],
#"Renamed Columns" = Table.RenameColumns(dbo,{{"YEAR(b.GL_TRXN_CRTD_DATE)", "Year"}})
in
#"Renamed Columns"

 

========================

 

To this:

 

//This code allows Power Bi to fold the query

 

let
Source = Value.NativeQuery(PostgreSQL.Database(Server, DataBase), "SELECT * FROM public.gl_summary_union", null, [EnableFolding=true]),
#"Renamed Columns" = Table.RenameColumns(Source,{{"YEAR(b.GL_TRXN_CRTD_DATE)", "Year"}})
in
#"Renamed Columns"

 

 

The weird thing is that the first code worked for a couple of months!

 

Thanks @vanessafvg  for your help.

Have a great day

 

Alejandro 

 

no problem glad its sorted





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.