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! Request now

Reply
mayankgupta3090
Regular Visitor

How to get the data of 24 hr from the current time but of user selected date

I have the data in my table for every 15 minutes.  Now user wnat to see the data for previous 24 hr from current time but of the selected. Suppose today is 05-May-2019 and user open the report today at 10:30 AM and selected the date of 27-April-2019 then report should contain the data from 26-Apr-2019 10:30AM to 27-APR-2019 10:30 AM. That means user want to see the data of last 24 hr of current time but of his selected date. I tried multiple solutions but nothing worked. Its urgent, earlies help is very much appreciable. I have multiple measures so I can't create individual calculation for each measure therefore I want something that can be applied as report level filter.

 

Thanks in advance!!!

1 ACCEPTED SOLUTION

I found the solution by following approach

1. Created the Calendar Table having Date,month,year column 

2. Lets call my data table as TblData and made no relation with Calendar Table

3. Use slicer to filter one month name of Calendar Table (drop Down)

4. Use another slicer to filter on Date field of Calendar Table (Drop Down)

5. Created Measure, Number of Records=1

6. Created another Measure, Isin4Hour =

Calculate (Max([Number of Records]),

                Filter('TblData', (('TblData'[DateTime].Date=(selectedValue('Calendar'[Date])-1) && TimeValue(TblData'[DateTime])>=TimeValue(Now()))

               || ('TblData'[DateTime].Date=(selectedValue('Calendar'[Date])) && TimeValue(TblData'[DateTime])<=TimeValue(Now()))

7. Put this measure on Visual Filter ans selce filter condition 'is=1'.

 

Now you will have the data of previous 24 hr of selected date from current time.


Thanks, Please do comment you scenario in which this approach is useful so that I can learn.

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

can you post some sample data of your tables?

Due to privacy, I am sharing sample dummy data. Now suppose User open the report  today @ 8:30 and  selected 02-03-2019, then report should contain only data from 01-03-20 8:30 to 02-03-2019 8:30. I have 50+ measures in my real dataset. Please help @Anonymous 

S.NoEntityDateTimeMeasure1
1A01-03-2019 08:002
2A01-03-2019 08:304
3A01-03-2019 18:0020
4A02-03-2019 01:3022
5A02-03-2019 02:0024

Request you to please help.

I found the solution by following approach

1. Created the Calendar Table having Date,month,year column 

2. Lets call my data table as TblData and made no relation with Calendar Table

3. Use slicer to filter one month name of Calendar Table (drop Down)

4. Use another slicer to filter on Date field of Calendar Table (Drop Down)

5. Created Measure, Number of Records=1

6. Created another Measure, Isin4Hour =

Calculate (Max([Number of Records]),

                Filter('TblData', (('TblData'[DateTime].Date=(selectedValue('Calendar'[Date])-1) && TimeValue(TblData'[DateTime])>=TimeValue(Now()))

               || ('TblData'[DateTime].Date=(selectedValue('Calendar'[Date])) && TimeValue(TblData'[DateTime])<=TimeValue(Now()))

7. Put this measure on Visual Filter ans selce filter condition 'is=1'.

 

Now you will have the data of previous 24 hr of selected date from current time.


Thanks, Please do comment you scenario in which this approach is useful so that I can learn.

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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 Solution Authors
Top Kudoed Authors