cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
pbeeyeqs
Helper I
Helper I

Current Month, Previous Months Counts Now Not Working

I can only assume this stopped working now that we are into a new year. It no longer calculates PREVIOUS MONTH, 2 MONTHS AGO, 3 MONTHS AGO, ...

 

It does calculate TOTAL COUNT THIS MONTH:

Total Count This Month =
COUNTX(
FILTER(
'_Report_All Logins',
AND(
MONTH([Activity_Date])=MONTH(TODAY()),
YEAR([Activity_Date])=YEAR(TODAY())
)
),
'_Report_All Logins'[dbo_USER_ACTIVITY_ID]
)

 

 

Here is what I have for PREVIOUS MONTH that no longer works:

Total Count Last Month =
COUNTX(
FILTER(
'_Report_All Logins',
MONTH([Activity_Date])=MONTH(TODAY()) -1
),
'_Report_All Logins'[dbo_USER_ACTIVITY_ID]
)
 
Any ideas?
 
Thanks in advance
2 ACCEPTED SOLUTIONS
mwegener
Super User II
Super User II

Hi @pbeeyeqs ,

 

quick and dirty.

 

Total Count Last Month =
COUNTX(
FILTER(
'_Report_All Logins',
MONTH([Activity_Date])= IF(MONTH(TODAY()) = 1, 12, MONTH(TODAY()) -1)
),
'_Report_All Logins'[dbo_USER_ACTIVITY_ID]
)
 
Regards,

Marcus

Dortmund - Germany
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.
Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener work at KUMAVISION AG , one of the world's largest
implementation partners for Microsoft Dynamics. #
"Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website


View solution in original post

Hi @pbeeyeqs ,

 

another dirty hack..

 

Total Count Last Month =
COUNTX(
FILTER(
'_Report_All Logins',
MONTH(DATEADD([Activity_Date],1, MONTH))=MONTH(TODAY())
),
'_Report_All Logins'[dbo_USER_ACTIVITY_ID]
)

 

Total Count 2 Months Ago =
COUNTX(
FILTER(
'_Report_All Logins',
MONTH(DATEADD([Activity_Date],2, MONTH))= MONTH(TODAY())
),
'_Report_All Logins'[dbo_USER_ACTIVITY_ID]
)

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener work at KUMAVISION AG , one of the world's largest
implementation partners for Microsoft Dynamics. #
"Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website


View solution in original post

3 REPLIES 3
mwegener
Super User II
Super User II

Hi @pbeeyeqs ,

 

quick and dirty.

 

Total Count Last Month =
COUNTX(
FILTER(
'_Report_All Logins',
MONTH([Activity_Date])= IF(MONTH(TODAY()) = 1, 12, MONTH(TODAY()) -1)
),
'_Report_All Logins'[dbo_USER_ACTIVITY_ID]
)
 
Regards,

Marcus

Dortmund - Germany
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.
Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener work at KUMAVISION AG , one of the world's largest
implementation partners for Microsoft Dynamics. #
"Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website


View solution in original post

That seems to work for previous month. How would it then figure 2 months ago, 3 months ago, ...

 

I have below for 2 months ago, but it doesn't seem to be correct:

 

Total Count 2 Months Ago =
COUNTX(
FILTER(
'_Report_All Logins',
MONTH([Activity_Date])= IF(MONTH(TODAY()) = 1, 12, MONTH(TODAY()) -2)
),
'_Report_All Logins'[dbo_USER_ACTIVITY_ID]
)

Hi @pbeeyeqs ,

 

another dirty hack..

 

Total Count Last Month =
COUNTX(
FILTER(
'_Report_All Logins',
MONTH(DATEADD([Activity_Date],1, MONTH))=MONTH(TODAY())
),
'_Report_All Logins'[dbo_USER_ACTIVITY_ID]
)

 

Total Count 2 Months Ago =
COUNTX(
FILTER(
'_Report_All Logins',
MONTH(DATEADD([Activity_Date],2, MONTH))= MONTH(TODAY())
),
'_Report_All Logins'[dbo_USER_ACTIVITY_ID]
)

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener work at KUMAVISION AG , one of the world's largest
implementation partners for Microsoft Dynamics. #
"Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website


View solution in original post

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors
Top Kudoed Authors