Forum Discussion
GJUDGE
4 years agoHelper II
Comparing Periods in the same table
I am sure this is a fairly straightforward problem for most but I'm fairly new to Power BI and any help is appreciated! I have a single table that compiles monthly reporting information. I want t...
- 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.
GJUDGE
4 years agoHelper II
jppv20 Thanks! If this can be built into the measure that would be best if you could advise?
jppv20
4 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))
Return
Output-OutputLastPeriod
Jori
If I answered your question, please mark it as a solution to help other members find it more quickly.
Connect on Linkedin