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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Records between 2 different dates and times

Heya All,

I have stucked with following:
Looking for solution to be able to see records between 2 different dates and times which always would follow up on current date. 
For example

between YESTERDAY 15:00 - TODAY 14:59

 

FILTER (
        'Calendar'[DateTime],
        'Calendar'[DateTime] > TODAY()-1+TIME(15,0,0)
            && 'Calendar'[DateTime] <= TODAY()+TIME(14,59,0)
    )



Could Anyone please help with above? 

Many Thanks 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Heya @amitchandak 

Thank You for pointing to right direction

Figured out the solution:

Measure =

CALCULATE (

    COUNT(HEADER[Order]),

    HEADER[Custom] >= TODAY()-1+TIME(15,0,0)

    && HEADER[Custom] <= TODAY()+TIME(14,59,0)

)

Created "Custom" column which is my creationdate+creationtime column and filter just works perfectly fine 

Many Thanks

View solution in original post

5 REPLIES 5
v-henryk-mstf
Community Support
Community Support

Hi @Anonymous ,

 

If the problem has been solved you can mark the reply for the standard answer to help the other members find it more quickly. If not, please point it out.


Looking forward to your feedback.


Best Regards,
Henry

Anonymous
Not applicable

Heya @v-henryk-mstf 

Marked as accepted solution.

Barney

Anonymous
Not applicable

Heya @amitchandak 

Thank You for pointing to right direction

Figured out the solution:

Measure =

CALCULATE (

    COUNT(HEADER[Order]),

    HEADER[Custom] >= TODAY()-1+TIME(15,0,0)

    && HEADER[Custom] <= TODAY()+TIME(14,59,0)

)

Created "Custom" column which is my creationdate+creationtime column and filter just works perfectly fine 

Many Thanks

amitchandak
Super User
Super User

@Anonymous , I doubt calendar table will have timestamp, unless you created one for every minute or second

 

You need a measure like this on datetime column of your table

 

CALCULATE( sum(Table[Values]) ,
FILTER (
'Table'[DateTime],
'Table'[DateTime] > TODAY()-1+TIME(15,0,0)
&& 'Table'[DateTime] <= TODAY()+TIME(14,59,0)
) )

Anonymous
Not applicable

Heya @amitchandak 

Did not work out. 

DISTINCTCOUNT('Table'[ORDER]),
FILTER (
'Table'[DateTime],
'Table'[DateTime] > TODAY()-1+TIME(15,0,0)
&& 'Table'[DateTime] <= TODAY()+TIME(14,0,0)
)
 
So there is a table where I would like to have a count of orders between that period
To make it simple Forexample 
COUNT OF ORDERS
YESTERDAY 15:00 - TODAY 15:00 

I dont know where the logic failing. 

Many Thanks

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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