Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
djk1000
Frequent Visitor

Month to date, ignoring context measure formula help!

Hi,

 

I'm trying to figure out a DAX measure formula and I've hit a wall, I'd appreciate some help!

 

I want to show the cumulative month to date sales, regardless of the current context. I have a slicer with different periods like "Current Week", "Current Month" etc. If I select "Current week" I have a cumulative sum which shows the cumulative totals for the week, I can drill down to day and see that, no problem.

 

I would like to have a month to date measure that takes the first and last dates of the context month, and gives me a cumulative sum, but the first row of the context has the total for the month up to that point.

 

Example:

Capture.PNG

 

If the Period is for instance "Financial Year" I would like this to work for each displayed month in the year, but historic months would of course show the same as the cumulative.

 

I have a date dimension and if it helps, I have FirstDateofMonth and LastDateOfMonth columns. 

 

Thanks for your help!

1 ACCEPTED SOLUTION

 I got it in the end:

 

Measure MTD = CALCULATE ([Sales], 
			  FILTER(ALL('Date Dynamic Period Dimension'),'Date Dynamic Period Dimension'[Date]>= MIN( 'Date Standard Dimension'[StartOfMonthDate])),
              FILTER (ALL ( 'Date Standard Dimension' ), 'Date Standard Dimension'[Date] >= MIN( 'Date Standard Dimension'[StartOfMonthDate] ) && 'Date Standard Dimension'[Date] <= MAX ('Date Standard Dimension'[Date])
    )
)

 

If you follow the tutorial I mentioned above, you get a standard date dimension and a dynamic date dimension (M2M join between them), my slicer is using the dynamic dimension. So I calculated the MTD with filters to reference both date tables.  I used the StartOfMonth and EndOfMonth columns in the standard date dimension, but I could do that in DAX too.

View solution in original post

3 REPLIES 3
v-sihou-msft
Microsoft Employee
Microsoft Employee

@djk1000

 

In this scenario, since you already have date column in your table, you can directly use TOTALMTD to get Month to date total. It will calculate up to current row date, no matter what you selected in slicer.

 

 

MTD = TOTALMTD(SUM('Table'[Amount]),'Table'[Date]) 

555.PNG

 

 

Regards,

 I got it in the end:

 

Measure MTD = CALCULATE ([Sales], 
			  FILTER(ALL('Date Dynamic Period Dimension'),'Date Dynamic Period Dimension'[Date]>= MIN( 'Date Standard Dimension'[StartOfMonthDate])),
              FILTER (ALL ( 'Date Standard Dimension' ), 'Date Standard Dimension'[Date] >= MIN( 'Date Standard Dimension'[StartOfMonthDate] ) && 'Date Standard Dimension'[Date] <= MAX ('Date Standard Dimension'[Date])
    )
)

 

If you follow the tutorial I mentioned above, you get a standard date dimension and a dynamic date dimension (M2M join between them), my slicer is using the dynamic dimension. So I calculated the MTD with filters to reference both date tables.  I used the StartOfMonth and EndOfMonth columns in the standard date dimension, but I could do that in DAX too.

djk1000
Frequent Visitor

Hi,

 

No answer to this yet, I wonder if the question makes sense? This is driving me crazy so any help would be greatly appreciated! In my post I mentioned a date period slicer, to achieve this I followed this tutorial:

 

https://www.fourmoo.com/2016/09/07/create-dynamic-periods-for-fiscal-or-calendar-dates-in-power-bi/

 

Thanks

 

!D

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors