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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

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
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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