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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.