Forum Discussion

Sujit_Thakur's avatar
Sujit_Thakur
Solution Sage
6 years ago
Solved

date time Relationship

Dear all, I have two tables Table A and Table B    Table A is a event where for every day we store records for every event along with time for eg    date column.   Time column  8/11/2020       ...
  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi Sujit_Thakur,

    It is impossible to build relationships as same as your requirement.

    In my opinion, I'd like to suggest you write a measure formula to check records based on your selections and use on 'visual level filter' to filter records.

    You can create two slicers that no direct effect the visual to pick up selected values of date values and time range.

    Measure =
    VAR selectedDate =
        MAX ( Calendar[Date] )
    VAR timeRange =
        ALLSELECTED ( Selecotr[Hour] )
    VAR currDate =
        MAX ( Table[Date] )
    VAR currTime =
        MAX ( Table[Time] )
    RETURN
        IF (
            curDate = selectedDate
                && AND (
                    HOUR ( currTime ) >= MINX ( timeRange, [Hour] ),
                    HOUR ( currTime ) <= MAXX ( timeRange, [Hour] )
                ),
            "Y",
            "N"
        )
    

    Reference link:

    Applying a measure filter in Power BI 

    Regards,

    Xiaoxin Sheng