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
ArmandC
New Member

Add a date range filter by selecting an event (that is linked in the background to a start/end time)

I have a set of data (temperature, stirring rate etc) that I would like to filter by date range (ie between start and end dates), however I don't want to have to look up the dates, because these are the start and end dates of specific events. I would like to choose the event, and have the temperature and stirring rate plotted automatically. 

 

See the data examples (mocked up quickly on excel), with the output I would like to have:

BatchStepstart timeend time
1charging01/01/2022 00:0001/01/2022 04:00
1mixing01/01/2022 04:0001/01/2022 11:00
1cooling01/01/2022 11:0001/01/2022 12:00

 

TagTimeValue 
temperature01/01/2022 00:0025
temperature01/01/2022 00:3024.7
temperature01/01/2022 01:0023.8
temperature01/01/2022 01:3020
temperature01/01/2022 02:0024
temperature01/01/2022 02:3024.5
temperature01/01/2022 03:0022.9
temperature01/01/2022 03:3024
temperature01/01/2022 04:0031
temperature01/01/2022 04:3031
temperature01/01/2022 05:0032
temperature01/01/2022 05:3034
temperature01/01/2022 06:0031
temperature01/01/2022 06:3032
temperature01/01/2022 07:0033
temperature01/01/2022 07:3033
temperature01/01/2022 08:0033
temperature01/01/2022 08:3032
temperature01/01/2022 09:0033
temperature01/01/2022 09:3032
temperature01/01/2022 10:0032
temperature01/01/2022 10:3033
temperature01/01/2022 11:005
temperature01/01/2022 11:303
temperature01/01/2022 12:002
stirring rate01/01/2022 00:000
stirring rate01/01/2022 00:300
stirring rate01/01/2022 01:000
stirring rate01/01/2022 01:300
stirring rate01/01/2022 02:000
stirring rate01/01/2022 02:300
stirring rate01/01/2022 03:000
stirring rate01/01/2022 03:300
stirring rate01/01/2022 04:00100
stirring rate01/01/2022 04:30100
stirring rate01/01/2022 05:00100
stirring rate01/01/2022 05:30100
stirring rate01/01/2022 06:00100
stirring rate01/01/2022 06:30100
stirring rate01/01/2022 07:00100
stirring rate01/01/2022 07:30100
stirring rate01/01/2022 08:00100
stirring rate01/01/2022 08:30100
stirring rate01/01/2022 09:00100
stirring rate01/01/2022 09:30100
stirring rate01/01/2022 10:00100
stirring rate01/01/2022 10:30100
stirring rate01/01/2022 11:0030
stirring rate01/01/2022 11:3030
stirring rate01/01/2022 12:0030

 

I can plot everything and get this:

ArmandC_0-1644578111741.png

But ideally, I could use a dropdown menu or something similar to filter by step:

ArmandC_1-1644578657045.png
So far I can plot my trends as a whole, and I can use sliders to choose date ranges, but I would love to be able to select a step, and power bi automatically selects the date ranges for me. My end goal is to be able to compare steps on multiple batches, but I will get there later 🙂

 

1 ACCEPTED SOLUTION
v-kkf-msft
Community Support
Community Support

Hi @ArmandC ,

 

Please try the following formula and show items when the Measure is not blank.

 

Measure = 
CALCULATE (
    COUNTROWS ( 'Table' ),
    FILTER (
        'Table',
        'Table'[Time] >= MIN ( 'Date range'[start time] )
            && 'Table'[Time] < MAX ( 'Date range'[end time] )
    )
)

vkkfmsft_0-1644913629305.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-kkf-msft
Community Support
Community Support

Hi @ArmandC ,

 

Please try the following formula and show items when the Measure is not blank.

 

Measure = 
CALCULATE (
    COUNTROWS ( 'Table' ),
    FILTER (
        'Table',
        'Table'[Time] >= MIN ( 'Date range'[start time] )
            && 'Table'[Time] < MAX ( 'Date range'[end time] )
    )
)

vkkfmsft_0-1644913629305.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

AllisonKennedy
Super User
Super User

@ArmandC Start with this: https://excelwithallison.blogspot.com/2020/06/dax-approximate-lookup.html

and this: https://excelwithallison.blogspot.com/2021/08/categorical-date-slicer-in-power-bi.html 

Then try this: https://excelwithallison.blogspot.com/2021/09/power-bi-forecasting-with-irregular.html 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

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.