Forum Discussion
Retrieve last day's data
- 4 years ago
Hi, David-INTEX
You can try the following methods.
Measure:
PreTurnover = Var PrevDate=MAXX(FILTER(ALL('Date'[Date]),'Date'[Date]<SELECTEDVALUE('Date'[Date])),'Date'[Date]) Var PreTurnover=CALCULATE(SUM('Date'[Value]),FILTER(ALL('Date'),[Date]=PrevDate)) Return PreTurnoverToday = CALCULATE([PreTurnover],FILTER(ALL('Date'),[Date]=TODAY()))Is this the output you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, David-INTEX
You can try the following methods.
Measure:
PreTurnover =
Var PrevDate=MAXX(FILTER(ALL('Date'[Date]),'Date'[Date]<SELECTEDVALUE('Date'[Date])),'Date'[Date])
Var PreTurnover=CALCULATE(SUM('Date'[Value]),FILTER(ALL('Date'),[Date]=PrevDate))
Return
PreTurnover
Today = CALCULATE([PreTurnover],FILTER(ALL('Date'),[Date]=TODAY()))
Is this the output you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello,
Thank you for your feedback, I have tried to set this up but I can't get the figures when there are no figures the day before.
For example, I have here the case with shipped files
I can see in the data that there were some from 03/06/2022 but not before. When I use the measurements, it shows me (Empty).
However, it works very well for the days that follow. Do you have a tip to solve this?
Thanks a lot !
- v-zhangti4 years ago
Community Support
Hi, David-INTEX
Can you provide a simple example file? Sensitive data can be removed in advance.
How to provide sample data in the Power BI Forum - Microsoft Power BI Community
What kind of expected results do you expect? You can also show it with pictures.
Best Regards
- David-INTEX4 years agoRegular Visitor
Hello,
Sorry for the delay in responding.
The expected result is that on Monday morning, I have the Friday figures displayed every time. Currently, since in my Dates table, I have the weekend days, my result is impossible with the proposed solutions.
Do you have a solution to remove the weekend days in the Dates table in DAX?- Whitewater1004 years ago
Solution Sage
Hi:
You can add 2 calc columns to your date table. Assume Date Table is named "Dates".
WeekDay = WEEKDAY(Dates[Date]) // this will give you day of week 1-7
WorkDay = Dates[WeekDay] <> 1 && Dates[WeekDay] <>7 // this will give TRUE for M-F and False for Weekends.You can filter so you set this to TRUE and weekends won't be involved.You can make just one calc col in Dates if you want to do:WorkDay Flag =
var dayofweek = WEEKDAY(Dates[Date])
result
dayofweek <> 1 && dayofweek <>7I hope this helps