Forum Discussion
Comparing Periods in the same table
- 4 years ago
Hi GJUDGE
You can use Edate() function to get last period, for example,
Last Period = var _currentDate=MAX('table'[date]) var _lastDate=EDATE(_currentDate,-1) return CALCULATE(SUM('table'[Output]),'table'[date]=_lastDate)Kindly note: Edate() function has some limitations,
If you can't use Edate() on some occasions, you can try this measure,
Last Period = var _maxDate=MAX('table'[date]) var _lastDate=DATE(YEAR(_maxDate),MONTH(_maxDate)-1,1) return CALCULATE(SUM('table'[Output]),'table'[date]=_lastDate)Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
hI GJUDGE ,
You can create this measure:
Jori
If I answered your question, please mark it as a solution to help other members find it more quickly.
Connect on Linkedin
jppv20 This isn't quite giving me what I need (but I appreciate your help!). When I put the measure into matrix view I get the following, which appears to be summing all the output months. How can I adapt the measure to only show the change for the latest month? i.e. -10 for project A, 5 for project B and 0 for project C with a total of -5?
- jppv204 years agoSolution Sage
GJUDGE Thanks for clarifying, I understand the issue better now. Do you need this to be solved in the measure? Otherwise you can add a date filter to select the month for which you want to see the change:
Jori
If I answered your question, please mark it as a solution to help other members find it more quickly.
Connect on Linkedin- GJUDGE4 years agoHelper II
jppv20 Thanks! If this can be built into the measure that would be best if you could advise?
- jppv204 years agoSolution Sage
In that case this measure should work:
OutputDifference =var Output = CALCULATE(SUM('Table'[Output]),FILTER('Table','Table'[Reporting Period]=MAXX('Table','Table'[Reporting Period])))var OutputLastPeriod = CALCULATE(SUM('Table'[Output]),FILTER('Table',MONTH('Table'[Reporting Period])=MONTH(MAXX('Table','Table'[Reporting Period]))-1))ReturnOutput-OutputLastPeriodJori
If I answered your question, please mark it as a solution to help other members find it more quickly.
Connect on Linkedin