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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
thupald
Regular Visitor

Duplicates – look at hotels that have booked overlapping dates for a travellers

Show the number of travellers in KPI card who appeared more than once with same checkin and checkout dates?

Example: 

thupald_0-1661191280387.png

from the above, count should 2.

ABC & BCD as the both passengers have same CheckIn date with different accomodations.

 

Can someone please help me achieveing the requirment above?

1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

Hi @thupald ,

 

Try formula like below:

result =
VAR _row1 =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        ALLEXCEPT (
            'Table',
            'Table'[Passenger Name],
            'Table'[CheckIn Date],
            'Table'[Checkout Date]
        )
    )
VAR _row2 =
    IF (
        CALCULATE (
            COUNTROWS ( 'Table' ),
            FILTER (
                ALL ( 'Table' ),
                'Table'[Passenger Name] = MAX ( 'Table'[Passenger Name] )
                    && 'Table'[Name] = MAX ( 'Table'[Name] )
            )
        ) = 0,
        0,
        1
    )
RETURN
    IF ( _row1 = 2 & _row2 = 0, COUNTROWS ( 'Table' ) )

 

If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


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

5 REPLIES 5
v-henryk-mstf
Community Support
Community Support

Hi @thupald ,

 

Try formula like below:

result =
VAR _row1 =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        ALLEXCEPT (
            'Table',
            'Table'[Passenger Name],
            'Table'[CheckIn Date],
            'Table'[Checkout Date]
        )
    )
VAR _row2 =
    IF (
        CALCULATE (
            COUNTROWS ( 'Table' ),
            FILTER (
                ALL ( 'Table' ),
                'Table'[Passenger Name] = MAX ( 'Table'[Passenger Name] )
                    && 'Table'[Name] = MAX ( 'Table'[Name] )
            )
        ) = 0,
        0,
        1
    )
RETURN
    IF ( _row1 = 2 & _row2 = 0, COUNTROWS ( 'Table' ) )

 

If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


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

parry2k
Super User
Super User

@thupald try this measure

 

SUMX ( 
   SUMMARIZE ( Table, Table[CheckInDate], Table[CheckOutDate], "@Cnt", DISTINCTCOUNT ( Table[PassengerName] ) ),
   [@Cnt]
)

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Double Bookings = 
SUMX(
    FILTER(
        SUMMARIZE(
            Bookings,
            Bookings[CheckIn Date],
            Bookings[CheckOut Date],
            Bookings[Passenger Name],
            "@Cnt", 
                DISTINCTCOUNT(Bookings[Accomodation Name]) - 1
        ),
        [@Cnt] > 0
    ),
    [@Cnt]
)

Hi
Thankyou for the quick response, Its not giving the expected result, is there any otherway which can implement the same

I'm not sure what you mean by an unexpected result.  Please explain.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.