Forum Discussion
ArchStanton
1 month agoPower Participant
Monthly Count not working
I have the following measure that works perfectly fine in a clustered columns chart as it shows me the current month total (597) ISINSCOPE New Cases =
IF(
ISINSCOPE(Date2[Mth]), -- Row Lev...
- 1 month ago
Small correction in the comments -
EOMONTH(TODAY(), -2) + 1 does not mean “go back 2 days + 1 day”. It means go to the end of the month — two months before today, then add 1 day — which gives the first day of the previous month.Check below comments added for full code for your reference -
New Cases this Month = VAR StartDate = IF ( DAY ( TODAY () ) = 1, EOMONTH ( TODAY (), -2 ) + 1, -- If today is the 1st, use the first day of the previous month EOMONTH ( TODAY (), -1 ) + 1 -- Otherwise, use the first day of the current month ) VAR EndDate = IF ( DAY ( TODAY () ) = 1, EOMONTH ( TODAY (), -1 ), -- If today is the 1st, use the last day of the previous month TODAY () -- Otherwise, use today ) RETURN CALCULATE ( COUNT ( 'Cases'[Case Number] ), DATESBETWEEN ( Date2[Date], StartDate, EndDate ) -- Count cases where Date2[Date] falls between StartDate and EndDate )💡 Helpful? Give a Kudos 👍 — keep the community growing
✅ Solved your issue? Mark as Solution ✔️ — help others find it faster
Best regards,
Rupasree Achari | BI & Fabric Analytics Engineer
Rupa01
1 month agoSolution Sage
Small correction in the comments -
EOMONTH(TODAY(), -2) + 1 does not mean “go back 2 days + 1 day”. It means go to the end of the month — two months before today, then add 1 day — which gives the first day of the previous month.
Check below comments added for full code for your reference -
New Cases this Month =
VAR StartDate =
IF (
DAY ( TODAY () ) = 1,
EOMONTH ( TODAY (), -2 ) + 1, -- If today is the 1st, use the first day of the previous month
EOMONTH ( TODAY (), -1 ) + 1 -- Otherwise, use the first day of the current month
)
VAR EndDate =
IF (
DAY ( TODAY () ) = 1,
EOMONTH ( TODAY (), -1 ), -- If today is the 1st, use the last day of the previous month
TODAY () -- Otherwise, use today
)
RETURN
CALCULATE (
COUNT ( 'Cases'[Case Number] ),
DATESBETWEEN (
Date2[Date],
StartDate,
EndDate
) -- Count cases where Date2[Date] falls between StartDate and EndDate
)
💡 Helpful? Give a Kudos 👍 — keep the community growing
✅ Solved your issue? Mark as Solution ✔️ — help others find it faster
Best regards,
Rupasree Achari | BI & Fabric Analytics Engineer
ArchStanton
1 month agoPower Participant
Thanks for your help, this works perfectly!