Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I have this formula
CALCULATE(
DISTINCTCOUNT('NG - Self Check Request List'[Created By.title]),
YEAR('NG - Self Check Request List'[Created]) = YEAR(TODAY()),
MONTH('NG - Self Check Request List'[Created]) = MONTH(TODAY()) - 1
)
/*CALCULATE(
DISTINCTCOUNT('NG - Self Check Request List'[Created By.title]),
FILTER(
ALL('NG - Self Check Request List'),
MONTH('NG - Self Check Request List'[Created]) = MONTH(TODAY()) - 1 &&
YEAR('NG - Self Check Request List'[Created]) = YEAR(TODAY())
)
)*/
it seems like this is an incorrect formula because it is showing 36, where it is only 19 users if checked manually on the sharepoint list. I fear that it is not counting distinctly thats why some counts were incorrect
Solved! Go to Solution.
Hi @KejGdr,
I hope you are doing well today❤️
So here is some approaches you can try and tell me if it works ☺️❤️
First Approache: (Using DATEADD)
Distinct Users Last Month =
CALCULATE(
DISTINCTCOUNT('NG - Self Check Request List'[Created By.title]),
DATEADD(TODAY(), -1, MONTH)
)
Second Approache: (Using Proper date filtering) - This should work perfectly
Distinct Users Last Month =
VAR CurrentDate = TODAY()
VAR FirstDayLastMonth = EOMONTH(CurrentDate, -2) + 1
VAR LastDayLastMonth = EOMONTH(CurrentDate, -1)
RETURN
CALCULATE(
DISTINCTCOUNT('NG - Self Check Request List'[Created By.title]),
'NG - Self Check Request List'[Created] >= FirstDayLastMonth,
'NG - Self Check Request List'[Created] <= LastDayLastMonth
)
Third Approache: Using PREVIOUSMONTH (if you have a date table)
Distinct Users Last Month =
CALCULATE(
DISTINCTCOUNT('NG - Self Check Request List'[Created By.title]),
PREVIOUSMONTH('Date'[Date])
)
Bonus Approache: Debugging version to verify your data
// Firstly check if the date filtering is working correctly
Count Last Month Records =
VAR CurrentDate = TODAY()
VAR FirstDayLastMonth = EOMONTH(CurrentDate, -2) + 1
VAR LastDayLastMonth = EOMONTH(CurrentDate, -1)
RETURN
CALCULATE(
COUNTROWS('NG - Self Check Request List'),
'NG - Self Check Request List'[Created] >= FirstDayLastMonth,
'NG - Self Check Request List'[Created] <= LastDayLastMonth
)
// Then check distinct users
Distinct Users Last Month =
VAR CurrentDate = TODAY()
VAR FirstDayLastMonth = EOMONTH(CurrentDate, -2) + 1
VAR LastDayLastMonth = EOMONTH(CurrentDate, -1)
RETURN
CALCULATE(
DISTINCTCOUNT('NG - Self Check Request List'[Created By.title]),
'NG - Self Check Request List'[Created] >= FirstDayLastMonth,
'NG - Self Check Request List'[Created] <= LastDayLastMonth
)
Important Tips:
Dont forget to check for blank values
Distinct Users Last Month (No Blanks) =
CALCULATE(
DISTINCTCOUNT('NG - Self Check Request List'[Created By.title]),
'NG - Self Check Request List'[Created By.title] <> BLANK(),
DATEADD(TODAY(), -1, MONTH)
)Hi @KejGdr,
I hope you are doing well today❤️
So here is some approaches you can try and tell me if it works ☺️❤️
First Approache: (Using DATEADD)
Distinct Users Last Month =
CALCULATE(
DISTINCTCOUNT('NG - Self Check Request List'[Created By.title]),
DATEADD(TODAY(), -1, MONTH)
)
Second Approache: (Using Proper date filtering) - This should work perfectly
Distinct Users Last Month =
VAR CurrentDate = TODAY()
VAR FirstDayLastMonth = EOMONTH(CurrentDate, -2) + 1
VAR LastDayLastMonth = EOMONTH(CurrentDate, -1)
RETURN
CALCULATE(
DISTINCTCOUNT('NG - Self Check Request List'[Created By.title]),
'NG - Self Check Request List'[Created] >= FirstDayLastMonth,
'NG - Self Check Request List'[Created] <= LastDayLastMonth
)
Third Approache: Using PREVIOUSMONTH (if you have a date table)
Distinct Users Last Month =
CALCULATE(
DISTINCTCOUNT('NG - Self Check Request List'[Created By.title]),
PREVIOUSMONTH('Date'[Date])
)
Bonus Approache: Debugging version to verify your data
// Firstly check if the date filtering is working correctly
Count Last Month Records =
VAR CurrentDate = TODAY()
VAR FirstDayLastMonth = EOMONTH(CurrentDate, -2) + 1
VAR LastDayLastMonth = EOMONTH(CurrentDate, -1)
RETURN
CALCULATE(
COUNTROWS('NG - Self Check Request List'),
'NG - Self Check Request List'[Created] >= FirstDayLastMonth,
'NG - Self Check Request List'[Created] <= LastDayLastMonth
)
// Then check distinct users
Distinct Users Last Month =
VAR CurrentDate = TODAY()
VAR FirstDayLastMonth = EOMONTH(CurrentDate, -2) + 1
VAR LastDayLastMonth = EOMONTH(CurrentDate, -1)
RETURN
CALCULATE(
DISTINCTCOUNT('NG - Self Check Request List'[Created By.title]),
'NG - Self Check Request List'[Created] >= FirstDayLastMonth,
'NG - Self Check Request List'[Created] <= LastDayLastMonth
)
Important Tips:
Dont forget to check for blank values
Distinct Users Last Month (No Blanks) =
CALCULATE(
DISTINCTCOUNT('NG - Self Check Request List'[Created By.title]),
'NG - Self Check Request List'[Created By.title] <> BLANK(),
DATEADD(TODAY(), -1, MONTH)
)Hi @Ahmed-Elfeel ,
I double checked and it seems like 36 was the correct answer all along for last month meaning my formula has also worked which is weird..
Glad it worked! Please mark as solution if this resolved your issue 😊
Hi @amitchandak
nothing changes this is like my 1st formula that I have tried but less the ALL() function correct? and interchanged the YEAR() and MONTH()
@KejGdr , Try like
CALCULATE(
DISTINCTCOUNT('NG - Self Check Request List'[Created By.title]),
filter('NG - Self Check Request List', YEAR('NG - Self Check Request List'[Created]) = YEAR(TODAY()) &&
MONTH('NG - Self Check Request List'[Created]) = MONTH(TODAY()) - 1
) )
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 |
|---|---|
| 19 | |
| 10 | |
| 9 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 31 | |
| 29 | |
| 21 | |
| 12 | |
| 12 |