Forum Discussion
Month to Date -X
The left column is the correct MTD, while the right column is utilizing the formula you shared.
I don't know if I am missing something, or not, but it doesn't appear to give me the results I am looking for.
Here is how I will eventually have it laid out, once I can get the formula squared away.
Regards,
MFelix
- vbaker8 years ago
Helper I
Here are my two DAX formulas being used.
MTD Amount = CALCULATE(SUM('Table'[Amount]), FILTER('Table',DAY('Table'[Date])<=DAY(TODAY()+1)))
MTD Amount-0 = VAR Date_Min = MIN('Table'[Date]) RETURN CALCULATE(SUM('Table'[Amount]), 'Table'[Date] = Date_Min)Here is the DAX I am using to do previous month. This could work with month, however not every month is the same number of days.
Previous Day-1 =
CALCULATE(SUM('Table'[Amount]),DATESBETWEEN('Table'[Date],LASTDATE('Table'[Date])-1,LASTDATE('Table'[Date])-1))- MFelix8 years ago
Super User
Hi vbaker,
Try to change your MTD Amount-0 to use the MTD Amount variable so basicly you are using the same calculation but when you add the context of previous 6 months it will get the min date for last 6 months.
MTD Amount-0 = VAR Date_Min = MIN('Table'[Date]) RETURN CALCULATE([MTD Amount], 'Table'[Date] = Date_Min)Regarding your question about the number of days you need to choose calendar months that way the calculations will get full month.
Please try the above change and tell me if it worked, other wise if it's possible please share a sample file so that I can check the calculations and give a best answer.
Regards,
MFelix
- vbaker8 years ago
Helper I
Unfortunately, this didn't work either. I need the calculation to be done within the measure, because I have more calculations that I need to run, once I can figure out how to the do the MTD calculations.
I have done this at the day level, as I showed previously, and it works, but I can't seem to get the month level to work.