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! It's time to submit your entry. Live now!
Good day,
Will someone please help me understand the steps to create a running monthly total that can be filtered by dates/conditions?
All my data is in one table (Episodes) with one row per unique ID. Here is a subset:
I have created a measure that calculates a running monthly total (24 months: JAN 2024-JAN2026) for each unique ID, but I am needing to filter out IDs if/when DeliveryDate (or EpisodeEndDate) is outside the ReportingMonth and/or EndOfReportingMonth.
For example, ID 1 should only be included in the running monthly total for 2/1/2024 - 6/1/2024.
I have been unsuccesfull using many different variations of the following logic :
EpisodeStartDate <= EndOfReportingMonth AND DeliveryDate is blank OR DeliveryDate >= ReportingMonth
Thank you very much for any guidance and help!
you can create a calculated column
StatusFlag =
IF(
Table[EpisodeStartDate] <= Table[EndOfReportingMonth]
&&
(
ISBLANK(Episodes[DeliveryDate])
||
Table[DeliveryDate] >= Table[ReportingMonth]
),
"y",
)
then add the calculated column to filters , slicers, visual filter or page filter
Proud to be a Super User!
If this solution worked for you, please Mark as Solution! It helps others in the community find this answer more easily. Cheers!
Hi @krishnakanth240,
the general pattern is something link this
Active IDs =
VAR MaxDate = MAX(Date[MonthEnd] )
VAR MinDate = MIN ( Date[MonthEnd] )
RETURN
CALCULATE(
COUNTROWS(Episodes),
( Episodes[Episode Start Date <=MaxDate && ISBLANK( Episodes[Delivery Date]) ) ||
Episodes[Delivery Date]>=MinDate,
REMOVEFILTERS ( Episodes )
)
Cumul Active IDs =
VAR MaxDate = MAX(Date[MonthEnd] )
RETURN
CALCULATE (
[Active IDs],
Date[Date]<=MaxDate
)
But to be sure to provide the righe answer, I need to know how you arrange the matrix (what you have in rows, columns, etc)
Best
If this helped, please consider giving kudos and mark as a solution
@me in replies or I'll lose your thread
Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page
Consider voting this Power BI idea
Francesco Bergamaschi
MBA, M.Eng, M.Econ, Professor of BI
Hi @E_Rye
Create a Date table( please check this post - https://community.fabric.microsoft.com/t5/Desktop/Creating-Date-Tables/m-p/553980) then provide relationship based on date column from Date table to your Main table
Create a measure
Active IDs =
CALCULATE(COUNTROWS(Episodes),FILTER(Episodes,Episodes[Episode Start Date <=MAX(Date[MonthEnd] )&&(
ISBLANK( Episodes[Delivery Date])
|| Episodes[Delivery Date]>=MIN(Date[MonthStart]))))
Cumulative Active IDs =CALCULATE([Active IDs],
FILTER(ALL(Date[Date]),Date[Date]<=MAX( Date[Date])))
Hii @E_Rye
In your data, an ID has a "Life Cycle" that starts at EpisodeStartDate and ends at DeliveryDate (or EpisodeEndDate). A standard running total often ignores the end date, causing IDs to stay in the count forever.
Step 1: Set up a Disconnected Date Table
For dynamic filtering to work across a 24-month trend, your X-axis should come from a separate Calendar table that is not directly linked to your Episodes dates. This allows the measure to compare the "Month being viewed" against the "Dates in the row."
Step 2: Create the "Active ID" Logic
Create a measure that determines if an ID is active during a given month. Use the logic you described: EpisodeStartDate must be on or before the end of the month, and the ID must not have been "Delivered" before the start of that month.
Active ID Count =
VAR _ReportMonthStart = MAX('Calendar'[Date])
VAR _ReportMonthEnd = EOMONTH(_ReportMonthStart, 0)
RETURN
CALCULATE(
DISTINCTCOUNT(Episodes[ID]),
KEEPFILTERS(
Episodes[EpisodeStartDate] <= _ReportMonthEnd &&
(ISBLANK(Episodes[DeliveryDate]) || Episodes[DeliveryDate] >= _ReportMonthStart)
)
)
Step 3: Create the Running Total
Now, wrap that "Active" logic into a running total calculation. This will iterate through all months up to the one currently being viewed in your chart.
Running Monthly Total =
VAR _MaxDate = MAX('Calendar'[Date])
RETURN
CALCULATE(
[Active ID Count],
FILTER(
ALLSELECTED('Calendar'),
'Calendar'[Date] <= _MaxDate
)
)
If you want to keep your existing simple count measure, you can create a "Flag" measure:
If this solution worked for you, please Mark as Solution! It helps others in the community find this answer more easily. Cheers!
Hello @AshokKunwar,
My semantic model already included a Date table not directly linked to the Episodes table, with a calculated column for Reporting Month = STARTOFMONTH('Date'[Date]).
I made one minor change to your logic for 'Active ID Count' to get the correct 'Running Monthly Total':
Thank you very much!
Hii @E_Rye
If this solution worked for you, please Mark as Solution! It helps others in the community find this answer more easily. Cheers!
| User | Count |
|---|---|
| 50 | |
| 42 | |
| 36 | |
| 31 | |
| 28 |
| User | Count |
|---|---|
| 139 | |
| 128 | |
| 60 | |
| 59 | |
| 57 |