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

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.

Reply
sakamotothais
Helper III
Helper III

hour in power BI language M

Hi,

I need help, if anyone knows.

I have a datetime column in the table, I make the direct query connection. And I want to add a column by bringing only the time, hour.
However when I put language m formula like datetime.time or time.hour, the query is not supported.

 

Capture.PNG

 

Then I need to add -3 hours in the hour column that I'll add.

Can anyone guide me where I'm going wrong?

 

Code:

let
    Source = Sql.Database("10.0.6.70,1433", "DailyBookings34"),
    DMBookings_BookingByLeg = Source{[Schema="DMBookings",Item="BookingByLeg"]}[Data],
    #"Filtered Rows" = Table.SelectRows(DMBookings_BookingByLeg, each Date.From([BookingDate]) = Date.From (DateTime.LocalNow ()) or Date.From([BookingDate]) = Date.AddDays (Date.From (DateTime.LocalNow ()) , -1) or Date.From([BookingDate]) = Date.AddDays (Date.From (DateTime.LocalNow ()), -7)),
    #"Added Custom2" = Table.AddColumn(#"Added Conditional Column", "BKDate", each DateTime.From([BookingDate])),
    #"Changed Type" = Table.TransformColumnTypes(#"Added Custom2",{{"BKDate", type datetimezone}}),
    #"Added Custom3" = Table.AddColumn(#"Changed Type", "Personalizado", each DateTime.Time([BKDate])),
    #"Changed Type1" = Table.TransformColumnTypes(#"Added Custom3",{{"Personalizado", type time}})
in
    #"Changed Type1"

thanks

1 ACCEPTED SOLUTION

Because you are using Direct Query mode, you have limited query capabilities; time intelligence functions are not supported.

 

See the article of September 25, 2017, Use DirectQuery in Power BI Desktop

Specializing in Power Query Formula Language (M)

View solution in original post

4 REPLIES 4
Interkoubess
Solution Sage
Solution Sage

Hi @sakamotothais,

 

Did you try Time.Hour([BKDate])?

 

Let us know.

 

Ninter.

 

Hi,

 

 I try but the query is not supported.

 

 Capture.PNG

 

Capture1.PNG

 

Note: My field is datetime when I make the formula it gets integer.

 

Thanks

Because you are using Direct Query mode, you have limited query capabilities; time intelligence functions are not supported.

 

See the article of September 25, 2017, Use DirectQuery in Power BI Desktop

Specializing in Power Query Formula Language (M)

Yeah, is true. 

I'll try to mount the dashboard with what's possible in the query editor M

 

Thanks

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.