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.
Greetings,
I am running the following query in PowerBi. It works well, but I need to pull data from another table, and add it to the output. highlighted below is the table & columns I want to extract data from.
let
Source = Sql.Database("DCSQLPA01", "Operations", [Query="SELECT TOP (100) PERCENT RTRIM(r.Name) AS rName, pr.Type, pr.Sequence, d.ParkRideID, pr.RideName, DATEDIFF(minute, d.TimeDown, d.TimeUp) AS DownTimeMins, d.TimeDown, d.TimeUp, s.Name, RTRIM(d.Reason) AS Reason, #(lf) RTRIM(d.Resolution) AS Resolution, RTRIM(d.Comments) AS Comments, pr.ParkID, p.Name AS Expr1#(lf)FROM dbo.ParkRideDowntimes AS d INNER JOIN#(lf) dbo.ParkRides AS pr ON pr.ID = d.ParkRideID INNER JOIN#(lf) dbo.Parks AS p ON pr.ParkID = p.ID INNER JOIN#(lf) dbo.DowntimeSubtypes AS s ON d.DowntimeSubtypeID = s.ID INNER JOIN#(lf) dbo.Rides AS r ON pr.RideID = r.ID#(lf)WHERE (d.timedown between '2019-05-03' and '2019-05-11') or (d.timedown between '2020-05-03' and '2020-05-11') or (d.timedown between '2021-05-03' and '2021-05-11')"]),
#"Sorted Rows" = Table.Sort(Source,{{"TimeDown", Order.Descending}})
in
#"Sorted Rows"
I want to pull three columns and have them be in the report.
Date
TimeOpen
TimeClose
From:
DCSQLPA01.Operations.dbo.ParkDailySchedules
I tried just adding it to the query, then tried a join. Neither worked. Hoping one of you folks knows how to write the statement I can add to my query.
Hi @Anonymous
What is the relationship between ParkDailySchedules table and other tables already in your query? Is there any field we can use to join the query?
Regards,
Community Support Team _ Jing
I know there is a field called ParkID that is used in both Tables, would that work?
I see you already have multiple joins in your query. Why can't you just join on DCSQLPA01.Operations.dbo.ParkDailySchedules and select the 3 columns you need? Try the query with this new join directly on the SQL server for testing purposes. If it works, then you shouldn't face any issue importing it to Power BI
I tried that, maybe I am writing the the statement incorrectly?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.