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
My data needs to be reported at a period level and a period is roughly 28 days, but not always. I need to report the cumulative sales at the day level for each period. The dax functions DATESMTD and DATESYTD are able to provide a cumulative sales at the month and year level. Are there any ways I could do this at the period level? Am I able to see the underlying code for those functions and make my own?
I can use calculate([Total Sales], DATESMTD(Dates[Date])) to get the cumulative sales for the month, but I need to get it at the period level.
My dates table is designed below.
Date | Period | Fiscal Year
First Create date period table like following:
| PeriodID | StartDate | EndDate |
|----------|-------------|-------------|
| 1 | 2024-01-01 | 2024-01-28 |
| 2 | 2024-01-29 | 2024-02-25 |
| 3 | 2024-02-26 | 2024-03-24 |
| ... | ... | ... |
//And then use this measure
CumulativeSalesPeriod =
CALCULATE(
SUM('YourTable'[Total Sales]),
FILTER(
ALL('YourTable'[Date]),
'YourTable'[Date] <= MAX('YourTable'[Date]) &&
'YourTable'[Date] >= MIN('YourTable'[Date]) &&
'YourTable'[Date] >= RELATED('PeriodTable'[StartDate]) &&
'YourTable'[Date] <= RELATED('PeriodTable'[EndDate])
)
)
Did I answer your question? If so, please mark my post as a solution!
Proud to be a Super User!
@mds123 You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000
Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...
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!