Dax - DATESMTD

DaveBlakeMAAT

Board Regular
Joined
Feb 28, 2016
Messages
187
Hi

I have a model of transactional data, which does include future dates, and i am having issues with DATESMTD, in the fact it appears to be picking the future dated transactions as the basis of calculating the MTD values

I have the following base measure (works fine):

Net Expenditure Total (£):=SUMX (
FILTER ( Payables, Payables[TYPE] IN { "PI", "PC" } ),
Payables[NET_AMOUNT]
)


My DATESMTD measures that i have tried are as follows:

(this returns the future months value)
MTD Expenditure (£)2:=CALCULATE (
[Net Expenditure Total (£)],
DATESMTD ( 'Calendar'[Date])
)


Therefore, my next thought was to use Filter to filter the calendar table to eliminate future transactions and this returns Blank
MTD Expenditure (£):=CALCULATE (
[Net Expenditure Total (£)],FILTER('Calendar','Calendar'[Date]<=EOMONTH(TODAY(),0)),
DATESMTD ( 'Calendar'[Date])
)


Any help is greatly appreciated.

Regards

Dave
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Matt Allington

MrExcel MVP
Joined
Dec 18, 2014
Messages
1,260
I call this calendar over run. The way I solve it is to create a calculated column that sets every date as “past” or “future”, or something like that. Eg IF(cal[date]>today(),”Future”,”Past”)

you can the. Simple filter on “past”
 

DaveBlakeMAAT

Board Regular
Joined
Feb 28, 2016
Messages
187
Thanks Matt

My apologies for the delayed response, that is a very helpful tip to remember for the future.

Regards

Dave
 

Watch MrExcel Video

Forum statistics

Threads
1,132,872
Messages
5,655,719
Members
418,233
Latest member
hussaind

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top