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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
mina97
Helper III
Helper III

count the number of orders

i have the following data 

 

date/timetype
19/9/2023 16:10:02A
20/2/2023 16:10:02B
20/2/2023 9:00:11B
20/3/2023 12:22:34A

 

i want the orders that comes after duty hours which is 7:00:00 to 15:00:00 to be included with the day after 

so the order number 2 should be summed with the orders on  20/3/2023 because it came on 16:10:02 which is after 15:00:00

 

please helo and thank you 

3 REPLIES 3
wdx223_Daniel
Super User
Super User

=CALCULATE(DISTINCTCOUNT(Table[Type]),FORMAT(Table[date/time]+TIME(9,0,0),"yyyyMMdd")="20230320")

hi i appreciate your help please check this out for clearity


what's the desired output?Count orders per day? yes count the orders py day with a condition which " if order came between the time  7:00:00 to 15:00:00 count it as today's orders if not count it with tommorrows orders. i hope it is clear

What do you do for the first order which is also outside your time range? the time range starts from 1/june/2018 and ends at today's date no matter what date is it today i need it to be automatically linked with today.

 

THANK YOU FOR CONSIDERATION and please help

Hi, @mina97

 

i am take these example

Dangar332_0-1695501866394.png

 

 

add column 

newtime = IF('Table'[time]>TIMEVALUE("15:00:00"),1,0)
 
and
newdate =
var currentdate = 'Table'[date]
var nextdate = MINX(FILTER('Table','Table'[date]>currentdate),'Table'[date])
var final = IF('Table'[newtime1]=1 &&  nextdate=BLANK() ,TODAY(),IF('Table'[newtime1]=1,nextdate,'Table'[date]))
return final
 
after adding two column it look llike these
Dangar332_1-1695502406107.png

 

put newdate and order to table 

Dangar332_2-1695502474467.png
  • Did i answer your question? Mark my post as a solution which help other people to find  fast and easily.

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Kudoed Authors