This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
Hello, I need a DAX query, to query a power bi dataset for values in the last week and is equivalent to the following one:
VAR __DS0FilterTable =
FILTER(
KEEPFILTERS(VALUES('salesty'[TRANS_DATE])),
AND(
'salesty'[TRANS_DATE] >= DATE(2022, 1, 2),
'salesty'[TRANS_DATE] < DATE(2022, 1, 9)
)
)
Basically, I think I need a DAX formula to get last week's values between Saturday and Saturday.
Solved! Go to Solution.
Thanks everybody for your suggestions.
Since the dataset was getting updated every monday, I was able to find a solution by using MAX function and subtracting the days.
Thanks everybody for your suggestions.
Since the dataset was getting updated every monday, I was able to find a solution by using MAX function and subtracting the days.
Hi,
You can use Weeknum to get this result. So something like this:
Now you can just refer to this var tables columns e.g. in SUMX and you cant get the results you want. I hope this helps and if it does consider accepting this as a solution and giving the post a thumbs up!
Proud to be a Super User!
@andreas789 , You need these new columns in date tbale
new columns
Week Start date = 'Date'[Date]+-1*WEEKDAY('Date'[Date],1)+1
Week End date = 'Date'[Date]+ 7-1*WEEKDAY('Date'[Date],1)
Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense)
OR
Week Rank = RANKX(all('Date'),'Date'[Year Week],,ASC,Dense) //YYYYWW format
then measures
This Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
Last Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))
Power BI — Week on Week and WTD
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...
https://www.youtube.com/watch?v=pnAesWxYgJ8
Hope the same work in report builder
Check out the May 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |