Forum Discussion
Calculate total not matching with Max function
- 6 years ago
Hi Mani_ms ,
Do you want to calculate the cumulative value when the month is equal to today's month, the other months show the value of the current month?
For example, when the month name is Aug, it will calculate the cumulative value.
If yes, you can use the following measure.
Measure = var _YTD = CALCULATE(SUM('Table'[quantity]),FILTER(ALLEXCEPT('Table','Table'[Country]),'Table'[Month number]<=MAX('Table'[Month number]))) var _currentmonth = FORMAT(TODAY(),"mmm") var _sum = SUM('Table'[quantity]) return IF( MAX('Table'[Month name])=_currentmonth,_YTD,_sum)If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
BTW, pbix as attached.
Hi Mani_ms ,
You can remove VALUE from the formula.
Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)
Hi Anonymous ,
Value i have used to convert text to number for the period. Somewhere i am missing..
- v-zhenbw-msft6 years ago
Community Support
Hi Mani_ms ,
Do you want to calculate the cumulative value when the month is equal to today's month, the other months show the value of the current month?
For example, when the month name is Aug, it will calculate the cumulative value.
If yes, you can use the following measure.
Measure = var _YTD = CALCULATE(SUM('Table'[quantity]),FILTER(ALLEXCEPT('Table','Table'[Country]),'Table'[Month number]<=MAX('Table'[Month number]))) var _currentmonth = FORMAT(TODAY(),"mmm") var _sum = SUM('Table'[quantity]) return IF( MAX('Table'[Month name])=_currentmonth,_YTD,_sum)If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
BTW, pbix as attached.