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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
jitpbi
Post Patron
Post Patron

specific time from datetime field

Hi,

 

from the below sample data, i need to display the values on the visual only for the time period 10:00 AM to 04:00 PM:

 

DateTime   Predicted ValueActual ValueVariation

9/8/2020 6:10:00 AM

100964
9/6/2020 8:10:00 AM991056
9/7/2020 10:20:00 AM101974
9/8/2020 12:02:00 PM98908
9/6/2020 3:32:00 PM96982
9/8/2020 04:00:00 PM100955
9/8/2020 06:02:00 PM82757
9/7/2020 08:02:00 PM54504
9/6/2020 11:11:00 PM30282

 

Any suggestion to acheive this really appreciated.

 

Thanks

1 ACCEPTED SOLUTION

@jitpbi ,

In power query you can use Time.Hour

Time.Hour([Datetime])

if you want to remove data you can now filter between 10 to 16 

 

if Time.Hour([Datetime])  >=10 and Time.Hour([Datetime])  <=16 then 1 else 0

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@jitpbi , Better you create a time column or use [Datetime].time in place ot time

 

time = [DateTime].time

Create formula for all measure you need

example
Predicted value M =calculate(Sum(Table[Predicted Value ]) , filter(Table, Table[time]>=time(10,0,0) && Table[Time]<=Time(16,0,0)))

Actual Value M =calculate(Sum(Table[Actual Value]) , filter(Table, Table[time]>=time(10,0,0) && Table[Time]<=Time(16,0,0)))

 

Or Create a time table. Join with table and use that as a filter.  You can column of 24 Hours and use a range too

https://kohera.be/blog/power-bi/how-to-create-a-time-table-in-power-bi-in-a-few-simple-steps/

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak ,

 

Just thinking to do it in the edit query, if we can select from the datetime field for the time 10 AM to 4 PM. So the data will be loaded for 10 AM to 4 PM only. Can you please help me to do this in power query.

 

Thanks

 

 

@jitpbi ,

In power query you can use Time.Hour

Time.Hour([Datetime])

if you want to remove data you can now filter between 10 to 16 

 

if Time.Hour([Datetime])  >=10 and Time.Hour([Datetime])  <=16 then 1 else 0

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak ,

 

I am gettiing another challenege after republishing the report to service, where i replaced with the existing dataset, the "hour" column is not showing in the table. Also getting the data for entire time as before not for the time (>=10 &<= 16) i filtered in the power query. The same file in desktop was working fine where hour column is there in the table and data is filtered for the time >=10 &<= 16.

Can you please suggest what would be the reason and how to resolve this.

 

Thanks 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.