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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
koralillis
New Member

calculate based on hours

How I can calculate based on hours.. for example all the sales of Friday after 10pm should be count as Monday sales

1 ACCEPTED SOLUTION
ray_ux
Memorable Member
Memorable Member

@koralillis  Something like this. i think that's what you are asking for?



 

SWITCH(
  TRUE(),
  Day IN {"Saturday", "Sunday"}, "Monday",
  Day = "Friday" && HourOfDay >= 22, "Monday",
  Day = "Sunday", "Monday",
  "WorkWeek")

 

 

 

View solution in original post

3 REPLIES 3
ray_ux
Memorable Member
Memorable Member

@koralillis  Something like this. i think that's what you are asking for?



 

SWITCH(
  TRUE(),
  Day IN {"Saturday", "Sunday"}, "Monday",
  Day = "Friday" && HourOfDay >= 22, "Monday",
  Day = "Sunday", "Monday",
  "WorkWeek")

 

 

 

amitchandak
Super User
Super User

@koralillis , In this logic, put an additional filter of 10 AM. OF create a date column, which move you friday date after 10 AM to Monday

https://amitchandak.medium.com/power-bi-show-weekend-data-on-monday-or-friday-dab5ee201f0e

 

New Date = Switch(True(),

weekDay([Date],2) =5 && Timevalue([Datetime]) >time(10,0,0), [Date]+3,

weekDay([Date],2) =6 , [Date]+2,

weekDay([Date],2) =7 , [Date]+1,

[Date]

)

 

Now use this new date

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Dinesh_Suranga
Continued Contributor
Continued Contributor

Hi @koralillis ,

Could you please share your data table with sample data?

Thank you.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.