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
Milan14
Frequent Visitor

Calculate Total Number of Users as at End Month

Hello everyone,

 

I would like to calculate the total number of users as at end month from date slicer, selected YEAR = 2021 and MONTH = February, include all the USERID who registered before the end of February 2021.

 

Sample table:

Milan14_0-1631450458295.png

 

Expected outcome in table:

Milan14_2-1631451251399.png

 

Thanks.

 

 

 

1 ACCEPTED SOLUTION
daxer-almighty
Solution Sage
Solution Sage

 

// You must have a Date table
// in your model that will not
// be connected to Registered Date.
// Then, if you select any period
// of time from it, the measure below
// will return the number of UserIDs
// it the current context that have
// their Registered Date before the
// last visible date. If you select
// a period like a full month, it'll
// be exactly what you want but the
// measure is more general. T is the
// name of the table. Assuming that
// UserId is unique in T.

[# Users] =
var LastDateSelected = max( Dates[Date] )
var Result =
    COUNTROWS(
        filter(
            T,
            T[Registered Date] < LastDateSelected
        )
    )
return
    Result
    
// or another version of the measure:

[# Users] =
var LastDateSelected = max( Dates[Date] )
var Result =
    CALCULATE(
        COUNTROWS( T ),
        KEEPFILTERS( 
            T[Registered Date] < LastDateSelected 
        )
    )
return
    Result

 

View solution in original post

2 REPLIES 2
daxer-almighty
Solution Sage
Solution Sage

 

// You must have a Date table
// in your model that will not
// be connected to Registered Date.
// Then, if you select any period
// of time from it, the measure below
// will return the number of UserIDs
// it the current context that have
// their Registered Date before the
// last visible date. If you select
// a period like a full month, it'll
// be exactly what you want but the
// measure is more general. T is the
// name of the table. Assuming that
// UserId is unique in T.

[# Users] =
var LastDateSelected = max( Dates[Date] )
var Result =
    COUNTROWS(
        filter(
            T,
            T[Registered Date] < LastDateSelected
        )
    )
return
    Result
    
// or another version of the measure:

[# Users] =
var LastDateSelected = max( Dates[Date] )
var Result =
    CALCULATE(
        COUNTROWS( T ),
        KEEPFILTERS( 
            T[Registered Date] < LastDateSelected 
        )
    )
return
    Result

 

Hi @daxer-almighty ,

 

Thanks for your help. It's exactly what I need ! 

 

Milan

Helpful resources

Announcements
November Fabric Update Carousel

Fabric Monthly Update - November 2025

Check out the November 2025 Fabric update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Users online (25)