Forum Discussion
New_be
6 years agoHelper V
Read previous rows from dates
Hi everyone! Im still new in power bi. Currently working on this project where i need to show the date for yesterday. For example in the image, if my date is 22/5/2020 (friday), i need to get t...
- 6 years ago
Try this
Column = VAR _PreviousDay = MAXX ( FILTER ( MyTable, MyTable[Date] < EARLIER ( MyTable[Date] ) && MyTable[Status] <> "OFF" ), MyTable[Date] ) VAR _result = SUMX ( FILTER ( MyTable, MyTable[Date] < EARLIER ( MyTable[Date] ) && MyTable[Date] >= _PreviousDay ), MyTable[Cost] ) RETURN _result
Did I answer your question? Mark my post as a solution!
Appreciate with a kudos 🙂
nandukrishnavs
6 years agoCommunity Champion
Try this
Column =
VAR _PreviousDay =
MAXX (
FILTER (
MyTable,
MyTable[Date]
< EARLIER ( MyTable[Date] )
&& MyTable[Status] <> "OFF"
),
MyTable[Date]
)
VAR _result =
SUMX (
FILTER (
MyTable,
MyTable[Date]
< EARLIER ( MyTable[Date] )
&& MyTable[Date] >= _PreviousDay
),
MyTable[Cost]
)
RETURN
_result
Did I answer your question? Mark my post as a solution!
Appreciate with a kudos 🙂
New_be
6 years agoHelper V
can i change my(cost) column in your code into a measure? i mean, can i use measure instead of column?