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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
mocha911
Frequent Visitor

Flag of counting multiple sign ins

I am trying to create a flag in the report to indicate which IP address has more than 1 member signing in within 3 consecutive days. 

 

Data looks like -

mocha911_0-1716347527164.png

Expected result -

mocha911_1-1716347583744.png

yellow case - it obsiously has multiple members signing in , so a flag of 1

orange case - as there were more than 1 member signing in on 3/5 and 4/5, so a flag of 1

green case - as B signed in more than 3 days from A, so a flag of 0

Can you please help me with the DAX? thank you

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_1-1716352421983.png

 

 

Jihwan_Kim_0-1716352397359.png

 

WINDOW function (DAX) - DAX | Microsoft Learn

 

expected result measure: =
SUMX (
    VALUES ( data[ip_address] ),
    CALCULATE (
        IF (
            COUNTROWS (
                FILTER (
                    ADDCOLUMNS (
                        SUMMARIZE ( data, 'calendar'[Date] ),
                        "@result",
                            CALCULATE (
                                COUNTROWS ( SUMMARIZE ( data, data[member] ) ),
                                WINDOW (
                                    -2,
                                    REL,
                                    0,
                                    REL,
                                    ALL ( 'calendar'[Date] ),
                                    ORDERBY ( 'calendar'[Date], ASC )
                                )
                            )
                    ),
                    [@result] > 1
                )
            ) > 0,
            1,
            0
        )
    )
)

 

 

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_1-1716352421983.png

 

 

Jihwan_Kim_0-1716352397359.png

 

WINDOW function (DAX) - DAX | Microsoft Learn

 

expected result measure: =
SUMX (
    VALUES ( data[ip_address] ),
    CALCULATE (
        IF (
            COUNTROWS (
                FILTER (
                    ADDCOLUMNS (
                        SUMMARIZE ( data, 'calendar'[Date] ),
                        "@result",
                            CALCULATE (
                                COUNTROWS ( SUMMARIZE ( data, data[member] ) ),
                                WINDOW (
                                    -2,
                                    REL,
                                    0,
                                    REL,
                                    ALL ( 'calendar'[Date] ),
                                    ORDERBY ( 'calendar'[Date], ASC )
                                )
                            )
                    ),
                    [@result] > 1
                )
            ) > 0,
            1,
            0
        )
    )
)

 

 

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Thank you so much for spending the time to do this! it works like a charm. I need to google to understand a couple of functions in there but wow....you are amazing! thank you

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.

Top Kudoed Authors