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
| Date | Day | Status |
| 19-05-2020 | Tuesday | |
| 20-05-2020 | Wednesday | |
| 21-05-2020 | Thursday | |
| 22-05-2020 | Friday | |
| 23-05-2020 | Saturday | OFF |
| 24-05-2020 | Sunday | OFF |
| 25-05-2020 | Monday | OFF |
| 26-05-2020 | Tuesday | OFF |
| 27-05-2020 | Wednesday | |
| 28-05-2020 | Thursday | |
| 29-05-2020 | Friday | |
| 30-05-2020 | Saturday | OFF |
| 31-05-2020 | Sunday | OFF |
| 01-06-2020 | Monday | |
| 02-06-2020 | Tuesday | |
| 03-06-2020 | Wednesday | |
| 04-06-2020 | Thursday |
Create a calculated column
Previous Working Day = MAXX(FILTER(MyTable,MyTable[Date]<EARLIER(MyTable[Date])&&MyTable[Status]<>"OFF"),MyTable[Date])
Did I answer your question? Mark my post as a solution!
Appreciate with a kudos 🙂