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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.