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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Dieu
Regular Visitor

Dynamic date time slicer

Hi everyone, 

 

I have 2 tables. The first table shows start time and end time of each lot number. Another table shows information in that time periods.

I want to create a slicer of lot number so that when I select lot number, I can see information in that time periods. I can't figure out how to do that.

Does anyone know how to do this please?

 

Screenshot 2024-08-13 222042.png 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @Dieu 

ryan_mayu's solution is perfect. 

And I would like to share some additional solutions below.

 

According to your description, you want to create a slicer of lot number so that when you select lot number, you can see information in that time periods? 

 

If I understand you correctly, then you can refer to my solution.  

 

I have extended the dataset based on some of the data you provided: 

vfenlingmsft_0-1723603377374.png

 

vfenlingmsft_1-1723603377375.png

Then you can New table: 
 

vfenlingmsft_2-1723603418625.png

 

CombinedTable = 
VAR LotTable = 'Table1'
VAR InfoTable = 'Table2'
RETURN
    SELECTCOLUMNS (
        FILTER (
            CROSSJOIN ( LotTable, InfoTable ),
            Table2[Sample time] >= Table1[Intake Time Start]
                && Table2[Sample time] <= Table1[Intake Time End]
        ),
        "Lot number", Table1[Lot Number],
        "Intake Time Start", Table1[Intake Time Start],
        "Intake Time End", Table1[Intake Time End],
        "Sample time", Table2[Sample Time],
        "Information", Table2[Information]
    )

 

Finally add a Slicer and drag Lot Number into the field to filter it: 

vfenlingmsft_3-1723603431220.png

 

 

Here is the result: 

vfenlingmsft_4-1723603431221.png

 

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Fen Ling,
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

5 REPLIES 5
Anonymous
Not applicable

Hi, @Dieu 

ryan_mayu's solution is perfect. 

And I would like to share some additional solutions below.

 

According to your description, you want to create a slicer of lot number so that when you select lot number, you can see information in that time periods? 

 

If I understand you correctly, then you can refer to my solution.  

 

I have extended the dataset based on some of the data you provided: 

vfenlingmsft_0-1723603377374.png

 

vfenlingmsft_1-1723603377375.png

Then you can New table: 
 

vfenlingmsft_2-1723603418625.png

 

CombinedTable = 
VAR LotTable = 'Table1'
VAR InfoTable = 'Table2'
RETURN
    SELECTCOLUMNS (
        FILTER (
            CROSSJOIN ( LotTable, InfoTable ),
            Table2[Sample time] >= Table1[Intake Time Start]
                && Table2[Sample time] <= Table1[Intake Time End]
        ),
        "Lot number", Table1[Lot Number],
        "Intake Time Start", Table1[Intake Time Start],
        "Intake Time End", Table1[Intake Time End],
        "Sample time", Table2[Sample Time],
        "Information", Table2[Information]
    )

 

Finally add a Slicer and drag Lot Number into the field to filter it: 

vfenlingmsft_3-1723603431220.png

 

 

Here is the result: 

vfenlingmsft_4-1723603431221.png

 

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Fen Ling,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you a lot for your solution. It helps me a lot ! 

ryan_mayu
Super User
Super User

@Dieu 

you can create a measure

 

Measure =
VAR _start=max('Table'[Intake time start])
VAR _end=max('Table'[Intake time end])
return if (max('Table (2)'[Sample time])>=_start && max('Table (2)'[Sample time])<=_end,1,0)
 
and add that measure to visual filter and set to 1
 
11.PNG
 
pls see the attachment below
 
 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thank you a lot for your solution 

you are welcome





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.