cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
majdkaid22 Member
Member

MTD measure

Hi guys,

 

my MTD & YTD measure show the figures up to t-1 (last calender day) even though there are transactions done today, they won't be included. 

 

This is my measure:  MTD Deposits = CALCULATE(SUM(meAccountTransaction[Deposits]), DATESMTD(meCalendar[DateValue])) 

 

Is there a trick to have today's transactions included? 

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
majdkaid22 Member
Member

Re: MTD measure

@KHorseman Many thanks mate. 

 

Still for some reason, what you have suggested did give me blank figures when I filter "current month" however you gave me the idea of doing the following:

 

I created a duplicate column for (meAccountTransaction[TransactionDate]) changed the format to date only and then created a direct relationship between (meAccountTransaction[TransactionDate]) and (meCalendar[DateValue]) 

 

Appreciate your help, it was a spot on. am getting the figures up to the minute!

View solution in original post

KHorseman Super Contributor
Super Contributor

Re: MTD measure

The columns in the relationship must be the same. If one is datetime and the other is date only, there will be zero matches between the two columns.


Did I answer your question? Please mark it as a solution.

Proud to be a Datanaut!

View solution in original post

16 REPLIES 16
BhaveshPatel Super Contributor
Super Contributor

Re: MTD measure

Is your date table is updated with the today's date as well?

Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.
majdkaid22 Member
Member

Re: MTD measure

@BhaveshPatel I have dates up the end of 2018 in my calander

 

and the "Is current Month" I use is: Is Current Month = IF(FORMAT(meCalendar[DateValue],"YYYY-MM")=FORMAT(CALCULATE(MAX(meAccountTransaction[TransactionDate]),ALL(meAccountTransaction)),"YYYY-MM"),"Yes","No") 

 

Could be something to do with the above "Is current Month"? 

BhaveshPatel Super Contributor
Super Contributor

Re: MTD measure

Can you please post the screenshots of your data model, sample data from all the tables for the further investigation.

Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.
KHorseman Super Contributor
Super Contributor

Re: MTD measure

DATESMTD will go to the last date in the current filter context. There is probably something about the way you're filtering your page or your visual that's eliminating today.

 

I made a quick test case. A table with entries on 9/1/2016, 9/28/2016 (yesterday), 9/29/2016 and 9/30/2016. Each date has an amount of 1.  My test measure was similar to yours:

 

Amount MTD = CALCULATE(SUM(TestTable[Amount]), DATESMTD(DateTable[Date]))

 

I plotted it against the Month column from my date table, with no other filters. It gives a total of 4, which means it includes not only today, but also tomorrow. If it had incorrectly stopped at t-1 like yours it would have totaled to 2. If I filter the visual so it only includes dates today and earlier, it totals correctly to 3. So the problem isn't in your formula, which means it should be either some report/page/visual filter or slicer, or it's missing data (i.e. your date table doesn't include today's date, or you forgot that you haven't actually refreshed your dataset this morning).


Did I answer your question? Please mark it as a solution.

Proud to be a Datanaut!
KHorseman Super Contributor
Super Contributor

Re: MTD measure

@majdkaid22 try this instead

 

Is Current Month = IF(
	MONTH(meAccountTransaction[TransactionDate]) = MONTH(TODAY()) &&
	YEAR(meAccountTransaction[TransactionDate]) = YEAR(TODAY()),
	"Yes",
	"No"
)

 


Did I answer your question? Please mark it as a solution.

Proud to be a Datanaut!
majdkaid22 Member
Member

Re: MTD measure

@KHorseman thanks!

 

You are right, I am using a filter on the page which is "Is current month" taking it from my Calander: Is Current Month = IF(FORMAT(meCalendar[DateValue],"YYYY-MM")=FORMAT(CALCULATE(MAX(meAccountTransaction[TransactionDate]),ALL(meAccountTransaction)),"YYYY-MM"),"Yes","No")

 

The reason am using this filter is to have all MTD measures working on this report, otherwise the measures will show blank like below.

 

Capture.JPG

 

Could be my "Is current Month" need some adjustment? 

 

 

majdkaid22 Member
Member

Re: MTD measure

@KHorseman it seems it has returned the correct (Yes/No) but when I apply it, all MTD measures are blank again. 

 

Could be because all my MTD measures are linked to the date in a calender? 

KHorseman Super Contributor
Super Contributor

Re: MTD measure

@majdkaid22 yes, your Is Current Month formula is the source of the problem. I'm sure you've already seen my suggested revision for that formula. Just be aware that if somehow transaction data gets entered with tomorrow's date, your MTD measure will include those too.

 

 


Did I answer your question? Please mark it as a solution.

Proud to be a Datanaut!
KHorseman Super Contributor
Super Contributor

Re: MTD measure

@majdkaid22 no, those formulas should all work as written. How are you applying Is Current Month? Are you using it in a visual filter or are you actually referring to it in another formula?


Did I answer your question? Please mark it as a solution.

Proud to be a Datanaut!

Helpful resources

Announcements
New Kudos Given Badges Coming

New Kudos Given Badges Coming

We're rolling out new Kudos Given badges. Find out how many Kudos you've given.

Microsoft Implementation for Communities Wins Award

Microsoft Implementation for Communities Wins Award

Learn about the award-winning innovation that was implemented across Microsoft’s Business Applications Communities.

Power Platform World Tour

Power Platform World Tour

Find out where you can attend!

Top Kudoed Authors (Last 30 Days)
Users online (1,842)