Reply
M_BODNER
Advocate I
Advocate I
Partially syndicated - Outbound

Summing Sales between two different date fields

I have sales in Invoice Line Items table with an invoice date and I need to sum those sales between two dates - the Check In and Check Out dates in the Hotel Reservation table. So essentially summing sales when the invoice date is on or between the check in and check out dates.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

Syndicated - Outbound

@M_BODNER , A new column  Reservation 

 

sumx(filter(Invoice, Invoice[Date]>= Reservation[Check in] && Invoice[Date]<= Reservation[Check out]), Invoice[Value])

 

or

 

Try a measure like

Sumx(Reservation,

sumx(filter(Invoice, Invoice[Date]>= Reservation[Check in] && Invoice[Date]<= Reservation[Check out]), Invoice[Value]) )

 

or

 

 

Sumx(Reservation,

calculate( sumx(filter(Invoice, Invoice[Date]>= Reservation[Check in] && Invoice[Date]<= Reservation[Check out]), Invoice[Value]) ) )

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
M_BODNER
Advocate I
Advocate I

Syndicated - Outbound

Thank you!!! Your second suggestion worked like a charm.

amitchandak
Super User
Super User

Syndicated - Outbound

@M_BODNER , A new column  Reservation 

 

sumx(filter(Invoice, Invoice[Date]>= Reservation[Check in] && Invoice[Date]<= Reservation[Check out]), Invoice[Value])

 

or

 

Try a measure like

Sumx(Reservation,

sumx(filter(Invoice, Invoice[Date]>= Reservation[Check in] && Invoice[Date]<= Reservation[Check out]), Invoice[Value]) )

 

or

 

 

Sumx(Reservation,

calculate( sumx(filter(Invoice, Invoice[Date]>= Reservation[Check in] && Invoice[Date]<= Reservation[Check out]), Invoice[Value]) ) )

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
avatar user

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.

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)