Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

New Users measure

Hi, 

I have a table where I have all the logins for each user, one line is one login.

I have a calculated column retrieving the registration date from another table via LOOKUPVALUE. I made this measure to be able to filter the data and see who are the "New" users for a specific month. A "New" user is defined as someone who has the registration date in a specific month. I am then filtering the dates with one or more months.

 

I created this that works but not in all cases, someone can help to debug it?

 

New Users Measure= 
            VAR NewUsers =
            FILTER (Table_Visitors,
                CONTAINS ( VALUES ( 'calendar'[Date] ), 'calendar'[Date], Table_Visitors[Registration Date] )
            )
        RETURN
        COUNTROWS(SUMMARIZE(NewUsers,Table_Visitors[Visitor ID]))

 

Thank you for your help!

  • Hi Anonymous ,

    Sorry for late back. Yes, for multiple lines in different month it also works. If in the same month there're multiple lines and you want to count all the lines, change the formula to:

    Measure =
    CALCULATE (
        DISTINCTCOUNT ( Table_Visitors[Visitor ID] ),
        FILTER (
            'Table_Visitors',
            COUNTROWS (
                FILTER ( 'Table_Visitors', 'Table_Visitors'[Month] = MAX ( 'calendar'[Month] ) )
            ) > 0
                && COUNTROWS (
                    FILTER (
                        'Table_Visitors',
                        'Table_Visitors'[Month]
                            = MAX ( 'calendar'[Month] ) - 1
                    )
                ) = 0
        )
    )

    Best Regards,
    Community Support Team _ kalyj

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

8 Replies

  • Hi Anonymous ,

     

    Without any data is difficult to understand where your measure is breaking.

     

    Can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.

    If the information is sensitive please share it trough private message.

  • Hi Anonymous ,

    According to your description, I create a sample.

    Table_Visitors:

    Calendar table:

    The two tables are related with date columns.

    Create a measure.

    Measure =
    CALCULATE (
        DISTINCTCOUNT ( Table_Visitors[Visitor ID] ),
        FILTER (
            'Table_Visitors',
            COUNTROWS (
                FILTER ( 'Table_Visitors', 'Table_Visitors'[Month] = MAX ( 'calendar'[Month] ) )
            ) > 0
                && COUNTROWS (
                    FILTER (
                        'Table_Visitors',
                        'Table_Visitors'[Month]
                            = MAX ( 'calendar'[Month] ) - 1
                    )
                ) = 0
        )
    )
    

    Get the result.

    I attach my sample below for your reference.

     

    Best Regards,
    Community Support Team _ kalyj

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

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you v-yanjiang-msft but in my Table_Visitors the same visitor can be in multiple lines (multiple logins), even though the registration date would be the same. Does your measure work also in this case?

      • v-yanjiang-msft's avatar
        v-yanjiang-msft
        Icon for Community Support rankCommunity Support

        Hi Anonymous ,

        Sorry for late back. Yes, for multiple lines in different month it also works. If in the same month there're multiple lines and you want to count all the lines, change the formula to:

        Measure =
        CALCULATE (
            DISTINCTCOUNT ( Table_Visitors[Visitor ID] ),
            FILTER (
                'Table_Visitors',
                COUNTROWS (
                    FILTER ( 'Table_Visitors', 'Table_Visitors'[Month] = MAX ( 'calendar'[Month] ) )
                ) > 0
                    && COUNTROWS (
                        FILTER (
                            'Table_Visitors',
                            'Table_Visitors'[Month]
                                = MAX ( 'calendar'[Month] ) - 1
                        )
                    ) = 0
            )
        )

        Best Regards,
        Community Support Team _ kalyj

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

  • Hi Anonymous ,

    Is your problem solved? If so, would you mind accept the helpful replies as solutions? Then we are able to close the thread. More people who have the same requirment will find the solution quickly and benefit here, thank you!

    Best Regards,
    Community Support Team _ kalyj