Forum Discussion

Dieu's avatar
Dieu
Regular Visitor
2 years ago
Solved

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 ...
  • Anonymous's avatar
    Anonymous
    2 years ago

    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: 

     

    Then you can New table: 
     

     

    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: 

     

     

    Here is the result: 

     

    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.