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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Jc_16
Frequent Visitor

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?

1 ACCEPTED SOLUTION
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: 

Lennard_0-1676925641982.png

 

Crossjoin:

virtable = filter(CROSSJOIN(cal,'Table'),'Table'[Arrival]<=cal[Date] && 'Table'[Departure] > cal[Date])
 
Lennard_1-1676925736775.png

Best regards

 

View solution in original post

4 REPLIES 4
Jc_16
Frequent Visitor

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

Jc_16_0-1676940509368.png

I can't do it like you said.

Can you help me with the problem?

Lennard
Frequent Visitor

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

 

 

Jc_16
Frequent Visitor

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

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: 

Lennard_0-1676925641982.png

 

Crossjoin:

virtable = filter(CROSSJOIN(cal,'Table'),'Table'[Arrival]<=cal[Date] && 'Table'[Departure] > cal[Date])
 
Lennard_1-1676925736775.png

Best regards

 

Helpful resources

Announcements
September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.