Forum Discussion
previous value
- Anonymous6 years ago
Hi IF,
Yes, it is possible.
You can extract current date text value and use it to find out the index, then do the calculation to get the previous month index and use it as a condition to filter table records to find out the previous date text.BTW, I also modify measure formula to replace allselcted with all function, you can try it if it works:
Previous result = VAR _current = SELECTEDVALUE ( Actual[month], MAX ( Actual[month] ) ) VAR prev = FORMAT ( DATE ( RIGHT ( _current, 4 ), LEFT ( _current, 2 ) - 1, 1 ), "mm.yyyy" ) RETURN CALCULATE ( DIVIDE ( SUM ( Actual[Days] ), SUM ( Actual[req] ) ), FILTER ( ALL ( Actual ), [month] = prev ) )Regards,
Xiaoxin Sheng
Hi IF,
Yes, it is possible.
You can extract current date text value and use it to find out the index, then do the calculation to get the previous month index and use it as a condition to filter table records to find out the previous date text.
BTW, I also modify measure formula to replace allselcted with all function, you can try it if it works:
Previous result =
VAR _current =
SELECTEDVALUE ( Actual[month], MAX ( Actual[month] ) )
VAR prev =
FORMAT (
DATE ( RIGHT ( _current, 4 ), LEFT ( _current, 2 ) - 1, 1 ),
"mm.yyyy"
)
RETURN
CALCULATE (
DIVIDE ( SUM ( Actual[Days] ), SUM ( Actual[req] ) ),
FILTER ( ALL ( Actual ), [month] = prev )
)
Regards,
Xiaoxin Sheng
Hi,
Thanks a lot! The measure works. You said that I can extract the current date text value and use it to find out index. For example; if a user selects "05.2020" the order (I mean index) for it is 3. How can I extract it?
On the other hand, previous month will be 3-1, which is 2. I want to show value for 2, which corresponds the previous month. How can I do it? You already mentioned but I didn't really understand it.
Bwy, I will accept the solution, but this way can be easier to use.
Best regards,
IF