Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi,
I'm seeking help to get the count of customers who have placed orders at least once every month for the past X months.
For example, I am hoping to capture the count of customers who have orders in October, November and December (past 2 months and current month).
Any help and guidance is much appreciated.
Thanks,
Ashley
Solved! Go to Solution.
Hi! Here's some DAX for something similar I did...
VAR Weeks = 2
VAR CurrentWeek =
CALCULATETABLE (
VALUES ( IdentityLog[IdentityId] ),
DATESINPERIOD (
'Calendar'[Date],
DATEADD (
LASTDATE ( 'Calendar'[Date] ),
( Weeks * 7 ) + 1,
DAY
),
7,
DAY
)
)
VAR PreviousWeek =
CALCULATETABLE (
VALUES ( IdentityLog[IdentityId] ),
DATESINPERIOD (
'Calendar'[Date],
DATEADD (
LASTDATE ( 'Calendar'[Date] ),
( ( Weeks - 1 ) * 7 ) + 1,
DAY
),
7,
DAY
)
)
VAR TwoWeeksAgo =
CALCULATETABLE (
VALUES ( IdentityLog[IdentityId] ),
DATESINPERIOD (
'Calendar'[Date],
DATEADD (
LASTDATE ( 'Calendar'[Date] ),
( ( Weeks - 2 ) * 7 ) + 1,
DAY
),
7,
DAY
)
)
RETURN
COUNTROWS (
CALCULATETABLE (
VALUES(IdentityLog[IdentityId]),
CurrentWeek,
PreviousWeek,
TwoWeeksAgo
)
)The measure above is intended to get the count of users who have logged in each week for three consecutive weeks. Replace my logic for weeks with current month, prior month and two months ago (PARALLELPERIOD() should make that very easy!).
hey this would do the trick (a measure):
if this was of help for your need let us know makring as soluction.
Proud to be a Super User!
@Anonymous , This measure can give distinct month has sales , with help from date table
Example
Rolling 3 = CALCULATE(distinctcount('Date'[Month-Year]),DATESINPERIOD('Date'[Date ],eomonth(MAX('Date'[Date ]),0),-3,MONTH), not(isblank(Sales[Sales Amount])))
Count of customers having entry in three month
new Measure = countx(filter(Summarize(Sales, sales[Customer], "_1",[Rolling 3]),[_1]=3),[Customer])
Thank you all for the solutions. I spent the last 2 weeks trying to find a solution myself on google search and got a solution within 1 day in this community. :). You guys are great!
@Anonymous , This measure can give distinct month has sales , with help from date table
Example
Rolling 3 = CALCULATE(distinctcount('Date'[Month-Year]),DATESINPERIOD('Date'[Date ],eomonth(MAX('Date'[Date ]),0),-3,MONTH), not(isblank(Sales[Sales Amount])))
Count of customers having entry in three month
new Measure = countx(filter(Summarize(Sales, sales[Customer], "_1",[Rolling 3]),[_1]=3),[Customer])
hey this would do the trick (a measure):
if this was of help for your need let us know makring as soluction.
Proud to be a Super User!
Hi! Here's some DAX for something similar I did...
VAR Weeks = 2
VAR CurrentWeek =
CALCULATETABLE (
VALUES ( IdentityLog[IdentityId] ),
DATESINPERIOD (
'Calendar'[Date],
DATEADD (
LASTDATE ( 'Calendar'[Date] ),
( Weeks * 7 ) + 1,
DAY
),
7,
DAY
)
)
VAR PreviousWeek =
CALCULATETABLE (
VALUES ( IdentityLog[IdentityId] ),
DATESINPERIOD (
'Calendar'[Date],
DATEADD (
LASTDATE ( 'Calendar'[Date] ),
( ( Weeks - 1 ) * 7 ) + 1,
DAY
),
7,
DAY
)
)
VAR TwoWeeksAgo =
CALCULATETABLE (
VALUES ( IdentityLog[IdentityId] ),
DATESINPERIOD (
'Calendar'[Date],
DATEADD (
LASTDATE ( 'Calendar'[Date] ),
( ( Weeks - 2 ) * 7 ) + 1,
DAY
),
7,
DAY
)
)
RETURN
COUNTROWS (
CALCULATETABLE (
VALUES(IdentityLog[IdentityId]),
CurrentWeek,
PreviousWeek,
TwoWeeksAgo
)
)The measure above is intended to get the count of users who have logged in each week for three consecutive weeks. Replace my logic for weeks with current month, prior month and two months ago (PARALLELPERIOD() should make that very easy!).
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 6 | |
| 6 | |
| 4 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 25 | |
| 21 | |
| 10 | |
| 8 | |
| 8 |