Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
So I've been stuggling with this, seems like quite a simple concept but that does seem to happen a lot with PBI
Here's some example data to paint a picture:
| Client | Date | Sale |
| A | 11/09/2021 | 100 |
| B | 11/09/2021 | 250 |
| A | 13/09/2021 | 300 |
| B | 14/09/2021 | 250 |
There's a date filter on the page I'm trying to get this measure working on filtered to 13/09/2021. I'm trying to create a card visualisation displaying a sum of the sales on the previous date in the table based on this filter (so sum should be 350).
PREVIOUSDAY doesn't work here, it only works when I set the filter to 14/09/2021. So I need a more dynamic solution for days when there are no sales in the database.
Any help would be greatly appreciated.
Solved! Go to Solution.
Hi @Anonymous
Get the previous date first
preDaySale =
VAR CurDay = SELECTEDVALUE(yourTable[Date])
VAR PreDay = MAXX(FILTER(ALL(yourTable),yourTable[Date]<CurDay),yourTable[Date])
RETURN
SUMX(FILTER(ALL(yourTable),yourTable[Date]=PreDay),yourTable[Sale])
Hi @Anonymous
Get the previous date first
preDaySale =
VAR CurDay = SELECTEDVALUE(yourTable[Date])
VAR PreDay = MAXX(FILTER(ALL(yourTable),yourTable[Date]<CurDay),yourTable[Date])
RETURN
SUMX(FILTER(ALL(yourTable),yourTable[Date]=PreDay),yourTable[Sale])
This worked, thank you very much! I hope others find this solution too as I spent a long time searching the forum to no avail.
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 58 | |
| 52 | |
| 40 | |
| 17 | |
| 16 |
| User | Count |
|---|---|
| 111 | |
| 109 | |
| 40 | |
| 33 | |
| 26 |