Forum Discussion
Christian2320
1 year agoNew Member
text to time
Hello! My first post here, thanks for reading! I have a PostgreSQL database with a table, which cointains schedule information of public transport. The hours of time of departure can be more than 2...
- 1 year ago
I see you mentioned using Direct query, I would suggest using Native query
1. Creating your model with the property "Direct Query Mode: Off".
-Then, If you create your own query, using Sql.Database()
let database name Source = Sql.Database("MyConnection", "DATABASE", [Query=" SELECT departure_time, -- Convert departure_time (HH:MM) to total minutes CAST(split_part(departure_time, ':', 1) AS INTEGER) * 60 + CAST(split_part(departure_time, ':', 2) AS INTEGER) AS total_minutes FROM transport_schedule "]), // if needed CleanedData = Table.SelectRows(Source, each [total_minutes] > 0) // Example of filtering in CleanedData-Once transformation is done you may switch to "Direct Query Mode: On"
That might work!
Christian2320
1 year agoNew Member
Thank you! I will give it a try. But custom columns often don't work in DirectQuery-Mode.
Hakuna_matata
1 year agoResolver I
I see you mentioned using Direct query, I would suggest using Native query
1. Creating your model with the property "Direct Query Mode: Off".
-Then, If you create your own query, using Sql.Database()
let
database name
Source = Sql.Database("MyConnection", "DATABASE", [Query="
SELECT
departure_time,
-- Convert departure_time (HH:MM) to total minutes
CAST(split_part(departure_time, ':', 1) AS INTEGER) * 60 + CAST(split_part(departure_time, ':', 2) AS INTEGER) AS total_minutes
FROM
transport_schedule
"]),
// if needed
CleanedData = Table.SelectRows(Source, each [total_minutes] > 0) // Example of filtering
in
CleanedData-Once transformation is done you may switch to "Direct Query Mode: On"
That might work!