Forum Discussion
Previous Month to Date
- 4 years ago
cham Try:
Measure Total = VAR __Total = SUMX(SUMMARIZE('Table',[End of Month],"__PrevMonth",[PreviousMonthMeasure]),[__PrevMonth]) RETURN IF(HASONEVALUE('Table'[End of Month]),[PreviousMonthMeasure],__Total)
cham You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000
Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TITHW/m-p/434008
In your case, maybe:
Amount Sales = SUM(Sales[Amount])
Prev Month To Date =
VAR __Date = MAX('Calendar'[Date])
VAR __PreviousMonth = DATE(YEAR(__Date),MONTH(__Date)-1,DAY(__Date))
VAR __FirstOfPrevMonth = DATE(YEAR(__PreviousMonth),MONTH(__PreviousMont),1)
RETURN
IF([MTH]=1, 0, CALCULATE ([Amount Sales], Calender[Date]>=__FirstOfPrevMonth, Calendar[Date]<=__PreviousMonth))
Sales Amount Mth = [Amount Sales] - [Prev Month To Date]Hi Greg_Deckler
The amount which are showing for each month is corrcet. The issue I am having is total for each year.
Ex: 2019 Total value is not the SUM of the 2019 Months Value.
Can you please help for this issue?
Thanks
- Greg_Deckler4 years ago
Community Champion
cham Oh, I misread. This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376
Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907- cham4 years ago
Post Patron
Hi Greg_Deckler
Please see the screesnhot below,
2020 year total is giving e the corrcet sum of 2020 months
But the measures I used to get the previous month value is correct. Every month is giving the previous month value but the Total of all the months values showing in sub total is incorrect.
WhatI can do for that.
thanks.
- Ashish_Mathur4 years ago
Super User
Hi,
I am confused but I'd also like to help you. Please show clearly in an MS Excel file, the result you are expecting.