Forum Discussion
Timeintelligence calculation group
- 2 years ago
Hi mbidelski
You could use LASTNONBLANK to identify the last date where SELECTEDMEASURE() is nonblank, then expand this to a month with PARALLELPERIOD.
This should leave the left chart unchanged, but adjust the right chart to display just the latest month.
Here is how I would write it.
I slightly rewrote the final expression after RETURN, but you don't have to change that.
-- Find the last month for which SELECTEDMEASURE() is nonblank VAR LastMonthAvailable = PARALLELPERIOD ( LASTNONBLANK ( 'Date'[Date], SELECTEDMEASURE ( ) ), 0, MONTH ) VAR PREV = CALCULATE ( SELECTEDMEASURE ( ), SAMEPERIODLASTYEAR ( LastMonthAvailable ) ) VAR CURR = CALCULATE ( SELECTEDMEASURE ( ), LastMonthAvailable ) RETURN IF ( AND ( NOT ISBLANK ( PREV ), NOT ISBLANK ( CURR ) ), DIVIDE ( CURR - PREV, PREV ) )Does this work for you?
Regards
Hi mbidelski
You could use LASTNONBLANK to identify the last date where SELECTEDMEASURE() is nonblank, then expand this to a month with PARALLELPERIOD.
This should leave the left chart unchanged, but adjust the right chart to display just the latest month.
Here is how I would write it.
I slightly rewrote the final expression after RETURN, but you don't have to change that.
-- Find the last month for which SELECTEDMEASURE() is nonblank
VAR LastMonthAvailable =
PARALLELPERIOD (
LASTNONBLANK ( 'Date'[Date], SELECTEDMEASURE ( ) ),
0,
MONTH
)
VAR PREV =
CALCULATE (
SELECTEDMEASURE ( ),
SAMEPERIODLASTYEAR ( LastMonthAvailable )
)
VAR CURR = CALCULATE ( SELECTEDMEASURE ( ), LastMonthAvailable )
RETURN
IF (
AND ( NOT ISBLANK ( PREV ), NOT ISBLANK ( CURR ) ),
DIVIDE ( CURR - PREV, PREV )
)
Does this work for you?
Regards
That's briliant, thanks a million!