Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.
Hi.
The full error message is:
Failed to save modifications to the server. Error returned: 'OLE DB or ODBC error: [DataSource.Error] Microsoft SQL: Incorrect syntax near the keyword 'union'.. '.
Trying to append two queries. See all queries below.
Append – Warranty ratios (BIDW)
let
Source = Table.Combine({#"Installed base - Power and TiLite (BIDW)", #"Warranty ratios (BIDW)"})
in
Source
Installed base – Power and TiLite (BIDW)
let
Source = Sql.Databases("SERVER"),
DATABASE = Source{[Name="DATABASE"]}[Data],
DW_V_InvoiceDetailsUNION = DATABASE{[Schema="DW",Item="V_InvoiceDetailsUNION"]}[Data],
#"Removed Other Columns" = Table.SelectColumns(DW_V_InvoiceDetailsUNION,{"WKInvoiceDate", "WKCustomer", "WKProduct", "IsChair", "SerialNumber"}),
#"Filtered Rows" = Table.SelectRows(#"Removed Other Columns", each ([SerialNumber] <> null and [SerialNumber] <> "" and [SerialNumber] <> "NA") and ([IsChair] = 1)),
#"Sorted Rows" = Table.Sort(#"Filtered Rows",{{"WKInvoiceDate", Order.Ascending}})
in
#"Sorted Rows"
Warranty ratios (BIDW)
let
Source = Sql.Databases("SERVER"),
DATABASE = Source{[Name="DATABASE"]}[Data],
DW_V_InvoiceDetailsUNION = DATABASE{[Schema="DW",Item="V_InvoiceDetailsUNION"]}[Data],
#"Removed Other Columns" = Table.SelectColumns(DW_V_InvoiceDetailsUNION,{"WKInvoiceDate", "WKCompany", "WKCustomer", "WKProduct", "WKOrderCategory", "SerialNumber", "NetAmount", "CostAmount", "OrderQuantity"}),
#"Filtered Rows1" = Table.SelectRows(#"Removed Other Columns", each ([SerialNumber] <> null and [SerialNumber] <> "" and [SerialNumber] <> "NA") and ([WKOrderCategory] = 6)),
#"Filtered Rows2" = Table.SelectRows(#"Filtered Rows1", each [WKInvoiceDate] >= #date(2015, 1, 1))
in
#"Filtered Rows2"
Solved! Go to Solution.
Hi.
Thanks. I found another solution, in another topic. I removed the sorting from one of the underlying queries -then the problem disappeared.
It seems both of the queries you want to append are from the same table in the same database. And I think your queries are good and I don't see any error.
Where do you use the Power Query Editor? In Power BI Desktop, Excel or Dataflow? If you are using Power BI Desktop, can you update it to the latest version and try the append operation again?
If updating the version of the application doesn't solve this problem, you could consider removing the applied steps one by one from the last step to check whether some specific transformation step caused this error.
You could also first connect to the same table in both queries and append the queries before any transformation to check whether they can be appended. If there is no error, then add the proceeding steps to transform the queries. If you find a step would cause this error, remove it and think about adding it in the appended query.
Hope this helps.
Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.
Hi.
Thanks. I found another solution, in another topic. I removed the sorting from one of the underlying queries -then the problem disappeared.
Check out the November 2023 Power BI update to learn about new features.
Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.
Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!