Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Condo/ Property Availability

I'm apologizing in advance as I'm well aware that this topic has been covered many times before. Though in all honesty, not exactly in the way that I am needing. It seems that when figuring Occupancy...
  • Anonymous's avatar
    Anonymous
    8 years ago

    HI Anonymous,

     

    You can refer to below steps if it suitable for your requirement.

     

    Steps:
    1. Create a expand table with detail date from date range of each record.

     

    Expand Table = 
    VAR _calendar =
        CALENDAR ( FIRSTDATE( Reservation[Check In] ), LASTDATE( Reservation[Check out] ) )
    RETURN
        SELECTCOLUMNS (
            FILTER (
                CROSSJOIN ( Reservation, _calendar ),
                [Date] >= [Check In]
                    && [Date] <= [Check out]
            ),
            "Reservation ID", Reservation[Reservation ID],
            "Detail Date", [Date]
        )
    

     

    2. Link original table by 'Reservation ID' column.

     

    3. Write measure to check dynamic status of selection date range.

    Available =
    IF (
        LASTDATE ( ALLSELECTED ( 'Expand Table'[Detail Date] ) )
            IN CALCULATETABLE (
                VALUES ( 'Expand Table'[Detail Date] ),
                ALLSELECTED ( Reservation[Room Id] )
            ),
        "N",
        "Y"
    )
    

    4. Create visuals.

     

    Notice: I attach pbix file below.

     

    Regards,

    Xiaoxin Sheng