Dax - DATESMTD

DaveBlakeMAAT

Board Regular
Joined
Feb 28, 2016
Messages
190
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

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
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”
 
Upvote 0
Thanks Matt

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

Regards

Dave
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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
Back
Top