Forum Discussion
venug20
8 years agoResolver I
Sale & Marketing Data Source Connect to SQL Server Error
Hi experts, I am trying to connect data source “SQL Server” from advanced editor, which I was download from Microsoft “Sales & Marketing Sample.PBIX” file. My Server name is : DESKTOP-F125T7K And ...
v-jiascu-msft
8 years agoMicrosoft Employee
Hi Venu,
Can the SQL Query run successfully in other tools like SSMS? Can you share the file? Are the blue parts just input error?
Source = Sql.Database("DESKTOP-F125T7K", "PowerBI", [Query="SELECT #(lf) p.ProductID,#(lf)
p.Product,#(lf) p.Category,#(lf) Segment,#(lf) m.[ManufacturerID],#(lf)
IIF(p.Manufacturer='Maximus', 'VanArsdel', p.Manufacturer) Manufacturer, #(lf) p.IsCompete#(lf)
FROM [dbo].[bi_Product] p, #(lf) (#(lf) select distinct [ManufacturerID], #(lf)Manufacturer#(lf)
from [PowerBI].[dbo].[bi_Sentiment]#(lf) ) m#(lf)where m.Manufacturer = p.Manufacturer"]),
Best Regards,
Dale
venug20
8 years agoResolver I
I got this file from https://docs.microsoft.com/en-us/power-bi/sample-sales-and-marketing
After that i want to edit from my "Power BI Desktop", it's through error like above....
- v-jiascu-msft8 years agoMicrosoft Employee
Hi venug20,
How did get the dataset and import it into SQL Server? There should be two tables [Product] and [Sentiment]. I only changed the Server name and DB name. It works. Can you share some snapshots of the status of tables in SQL Server? Since it's a public dataset, can you share the dataset?
let Source = Sql.Database("dale2016", "fortest", [Query="SELECT #(lf) p.ProductID,#(lf) p.Product,#(lf) p.Category,#(lf) Segment,#(lf) m.[ManufacturerID],#(lf) IIF(p.Manufacturer='Maximus', 'VanArsdel', p.Manufacturer) Manufacturer, #(lf) p.IsCompete#(lf)FROM [Product] p, #(lf) (#(lf) select distinct [ManufacturerID], #(lf)Manufacturer#(lf) from [Sentiment]#(lf) ) m#(lf)where m.Manufacturer = p.Manufacturer"]), #"Renamed Columns" = Table.RenameColumns(Source, {{"Manufacturer", "Manufacturer"}, {"Category", "Category"}, {"Segment", "Segment"}, {"Product", "Product"}, {"ProductID", "ProductID"}, {"IsCompete", "IsCompeteHide"}, {"ManufacturerID", "ManufacturerID"}}), #"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns", {{"Manufacturer", type text}, {"Category", type text}, {"Segment", type text}, {"Product", type text}, {"ProductID", Int64.Type}, {"IsCompeteHide", type text}, {"ManufacturerID", Int64.Type}}) in #"Changed Type"Best Regards,
Dale