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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Arnauar97
Regular Visitor

Measure to calculate bookings created based on selected check-in date

Hi everyone,

I’m trying to calculate a measure in Power BI to show the bookings created for a hotel. My goal is that, when selecting a specific month in a page filter (linked to my Dim_Date table), a bar chart distributes the bookings created by their creation date, but only for bookings whose check-in date falls within the selected month.

 

Currently, I’m using this measure:

 

BookingsCreated_MonthCreated =
CALCULATE(
DISTINCTCOUNT('Fact_MovRvas'[RESERVA_PK]),
ALLEXCEPT('A0Dim_Fecha', A0Dim_Fecha[Month Name]),
'Fact_MovRvas'[FECHAENTRADA] IN VALUES(A0Dim_Fecha[Date])
)

 

The page filter is set up to select year and month from the Dim_Date table. However, the measure doesn’t seem to work as expected. While the chart updates when the filter changes, the bars aren’t distributed properly by the creation date (FECHACREACION), and it seems that the bookings aren’t being correctly filtered by the check-in date.

I’d also like to create a similar calculation for canceled bookings, following the same logic but using the cancellation date instead of the creation date.

Could anyone guide me on how to adjust this measure to achieve the desired result? Any help would be greatly appreciated!

 

Thanks!!

1 ACCEPTED SOLUTION
v-junyant-msft
Community Support
Community Support

Hi @Arnauar97 ,

Thanks for BeaBF's reply!
And @Arnauar97 , I don't know what your data model looks like, but I think your DAX should be able to meet your needs, but you need to disconnect your table Fact_MovRvas from the table Dim_Date. The following is the sample data I created myself:

vjunyantmsft_0-1737424835613.png

vjunyantmsft_1-1737424844577.png

There is no relationship between them:

vjunyantmsft_2-1737424874879.png

Then use these DAXs to create measures:

 

BookingsCreated_MonthCreated = 
CALCULATE(
    DISTINCTCOUNT(Fact_MovRvas[RESERVA_PK]),
    ALL(Fact_MovRvas),
    'Fact_MovRvas'[Check-in Date] IN VALUES(Dim_Date[Date])
)
BookingsCanceled_MonthCanceled = 
CALCULATE(
    DISTINCTCOUNT(Fact_MovRvas[RESERVA_PK]),
    ALL(Fact_MovRvas),
    'Fact_MovRvas'[Cancellation Date] IN VALUES(Dim_Date[Date])
)

 

And the final output is as below:

vjunyantmsft_3-1737424943887.png

vjunyantmsft_5-1737424991440.png

vjunyantmsft_6-1737425023670.png


If this does not solve your problem, please provide sample data of your tables and the relationship between the tables, thank you!

Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-junyant-msft
Community Support
Community Support

Hi @Arnauar97 ,

Thanks for BeaBF's reply!
And @Arnauar97 , I don't know what your data model looks like, but I think your DAX should be able to meet your needs, but you need to disconnect your table Fact_MovRvas from the table Dim_Date. The following is the sample data I created myself:

vjunyantmsft_0-1737424835613.png

vjunyantmsft_1-1737424844577.png

There is no relationship between them:

vjunyantmsft_2-1737424874879.png

Then use these DAXs to create measures:

 

BookingsCreated_MonthCreated = 
CALCULATE(
    DISTINCTCOUNT(Fact_MovRvas[RESERVA_PK]),
    ALL(Fact_MovRvas),
    'Fact_MovRvas'[Check-in Date] IN VALUES(Dim_Date[Date])
)
BookingsCanceled_MonthCanceled = 
CALCULATE(
    DISTINCTCOUNT(Fact_MovRvas[RESERVA_PK]),
    ALL(Fact_MovRvas),
    'Fact_MovRvas'[Cancellation Date] IN VALUES(Dim_Date[Date])
)

 

And the final output is as below:

vjunyantmsft_3-1737424943887.png

vjunyantmsft_5-1737424991440.png

vjunyantmsft_6-1737425023670.png


If this does not solve your problem, please provide sample data of your tables and the relationship between the tables, thank you!

Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

BeaBF
Super User
Super User

@Arnauar97 Hi! Try with:

 

BookingsCreated_MonthCreated =
CALCULATE(
DISTINCTCOUNT('Fact_MovRvas'[RESERVA_PK]),
FILTER(
'Fact_MovRvas',
'Fact_MovRvas'[FECHAENTRADA] IN VALUES(A0Dim_Fecha[Date])
),
REMOVEFILTERS(A0Dim_Fecha),
VALUES(A0Dim_Fecha[Month Name])
)

 

BBF

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! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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