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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
mina97
Helper III
Helper III

count the real number of requests

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 help and thank you 

4 REPLIES 4
Dangar332
Super User
Super User

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.

 

ERD
Community Champion
Community Champion

@mina97 , what's the desired output? Count orders per day? What do you do for the first order which is also outside your time range?

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

@ERD hi i appreciate your help


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

ERD
Community Champion
Community Champion

@mina97 , I'm still not sure about the expected output. Anyway, you can try this measure to achieve the result according to my understanding:

Measure =
VAR real_dates =
    ADDCOLUMNS (
        'Table',
        "@real_date",
            VAR current_time = [Time]
            VAR check_time =
                current_time >= TIME ( 07, 00, 00 ) && current_time <= TIME ( 15, 00, 00 )
            VAR current_date = [Date]
            VAR check_date =
                IF ( check_time, current_date, current_date + 1 )
            RETURN
                check_date
    )
VAR t =
    GENERATE (
        VALUES ( 'Date'[Date] ),
        VAR dt = 'Date'[Date]
        RETURN
            ROW ( "rows_amt", COUNTROWS ( FILTER ( real_dates, [@real_date] = dt ) ) )
    )
RETURN
    SUMX ( t, [rows_amt] )

Here I use a Date table, not connected to the data table:

ERD_0-1695657764374.png

Date in the first column is from the Date table.

ERD_1-1695657790883.png

If we compare with the original date:

ERD_2-1695657854038.png

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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