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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

DISTINCTCOUNT if id each every month.

Hello
I have a 6 moths data. It's web logins. I need a measure, where i could calculate HOW UNIQUE USERS LOGINS EVERY MONTH, and if this users logins every month - return count, and if not logins every moth - not return. 
For example

user_idlogin_dateweb/app 
12022-05-05web 
22022-05-05web 
32022-05-05web 
42022-05-05app 
12022-06-05app 
52022-06-05web 
32022-06-05app 
12022-07-05web 
62022-07-05web 
32022-07-05web 
12022-08-05app 
62022-08-05web 
72022-08-05web 

And this i need:

DateUnique users allUnique u. per periodlogin every month 
month 544  
month 6532 
month 7632 
month 8731 

Thank you. I not have idea. 😞 

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

You can try the following methods.

 

Unique users all = CALCULATE(MAX('Table'[user_id]),ALLEXCEPT('Table','Table'[login_date]))
Unique u. per period = CALCULATE(COUNT('Table'[web/app]),ALLEXCEPT('Table','Table'[login_date]))
Measure =
CALCULATE (
    COUNT ( 'Table'[user_id] ),
    FILTER (
        ALL ( 'Table' ),
        [user_id] = SELECTEDVALUE ( 'Table'[user_id] )
            && [login_date] <= SELECTEDVALUE ( 'Table'[login_date] )
    )
)
login every month =
CALCULATE (
    COUNT ( 'Table'[user_id] ),
    FILTER (
        ALL ( 'Table' ),
        [Measure] >= 2
            && [login_date] = SELECTEDVALUE ( 'Table'[login_date] )
    )
)

 

vzhangti_0-1661837618055.png

Is this the result you expect? If I misunderstand, please provide more explanation.

 

Best Regards,

Community Support Team _Charlotte

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-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

You can try the following methods.

 

Unique users all = CALCULATE(MAX('Table'[user_id]),ALLEXCEPT('Table','Table'[login_date]))
Unique u. per period = CALCULATE(COUNT('Table'[web/app]),ALLEXCEPT('Table','Table'[login_date]))
Measure =
CALCULATE (
    COUNT ( 'Table'[user_id] ),
    FILTER (
        ALL ( 'Table' ),
        [user_id] = SELECTEDVALUE ( 'Table'[user_id] )
            && [login_date] <= SELECTEDVALUE ( 'Table'[login_date] )
    )
)
login every month =
CALCULATE (
    COUNT ( 'Table'[user_id] ),
    FILTER (
        ALL ( 'Table' ),
        [Measure] >= 2
            && [login_date] = SELECTEDVALUE ( 'Table'[login_date] )
    )
)

 

vzhangti_0-1661837618055.png

Is this the result you expect? If I misunderstand, please provide more explanation.

 

Best Regards,

Community Support Team _Charlotte

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

 

daXtreme
Solution Sage
Solution Sage

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors