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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors