Forum Discussion

Jc_16's avatar
Jc_16
Frequent Visitor
3 years ago
Solved

How to distribut days

I'm working in a hotel and I need to distribut and sum the number of night on each Monty.

For example, a client stay since 28/12/2022 to 03/01/2023, (3 nights in december and 3 nights in January)

Now I can count the number of nights per Month, but I can't sum the total of nights for each Month.

 

 

Can you help me?

  • Hey there,

     

    I guess your data table looks similar to this: 

    GuestArrivalDeparture
    A27.12.202205.01.2023
    B30.11.202201.12.2022

     

    ?

     

    Then try:

     

    Calendartable: 

     

    Crossjoin:

    virtable = filter(CROSSJOIN(cal,'Table'),'Table'[Arrival]<=cal[Date] && 'Table'[Departure] > cal[Date])
     

    Best regards

     

4 Replies

  • Lennard's avatar
    Lennard
    Frequent Visitor

    Hey there,

     

    I guess your data table looks similar to this: 

    GuestArrivalDeparture
    A27.12.202205.01.2023
    B30.11.202201.12.2022

     

    ?

     

    Then try:

     

    Calendartable: 

     

    Crossjoin:

    virtable = filter(CROSSJOIN(cal,'Table'),'Table'[Arrival]<=cal[Date] && 'Table'[Departure] > cal[Date])
     

    Best regards

     

  • Jc_16's avatar
    Jc_16
    Frequent Visitor

    Hello,
    I'm having some problems when I wrote the querry:

    I can't do it like you said.

    Can you help me with the problem?

    • Lennard's avatar
      Lennard
      Frequent Visitor

      Please try to convert your check-in/check-out data in your reservas-data to date-type. 

       

       

      • Jc_16's avatar
        Jc_16
        Frequent Visitor

        I have already done it but I can't execute the crossjoin.