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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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