Forum Discussion
Difference in values between 2 months
Hello all!
Im trying to create a measure that calculates the difference between this months (FloatDays) and Last months
below is the table im using just a simple calculation like (ThisMonthsFloatTotal - LastMonthsFloatTotal)
for some reason im struggling to make this in power bi
any suggestions?
Thank you in advance!!
Hi, yazenbarakat123
Please try the following mesaures:
Last months = CALCULATE ( MAX ( 'Table'[FloatDays] ), FILTER ( ALL ( 'Table' ), 'Table'[ActivityID] = MAX ( 'Table'[ActivityID] ) && 'Table'[Month] = EDATE ( MAX ( 'Table'[Month] ), -1 ) ) )Resilt = IF(ISBLANK('Table'[Last months]),BLANK(), MAX('Table'[FloatDays])-'Table'[Last months])Best Regards,
Community Support Team _ Eason
3 Replies
- v-easonf-msftCommunity Support
Hi, yazenbarakat123
Please try the following mesaures:
Last months = CALCULATE ( MAX ( 'Table'[FloatDays] ), FILTER ( ALL ( 'Table' ), 'Table'[ActivityID] = MAX ( 'Table'[ActivityID] ) && 'Table'[Month] = EDATE ( MAX ( 'Table'[Month] ), -1 ) ) )Resilt = IF(ISBLANK('Table'[Last months]),BLANK(), MAX('Table'[FloatDays])-'Table'[Last months])Best Regards,
Community Support Team _ Eason- yazenbarakat123Helper I
Thank you for the response v-easonf-msft this works perfectly!
- amitchandakSuper User
yazenbarakat123 , You can use time intelligence with date table
examples
MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth('Date'[Date]))
next month Sales = CALCULATE(SUM(Sales[Sales Amount]),nextmonth('Date'[Date]))
this month = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH('Date'[Date])))Power BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA