Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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 July 2025 Power BI update to learn about new features.
User | Count |
---|---|
23 | |
9 | |
7 | |
6 | |
6 |
User | Count |
---|---|
28 | |
11 | |
11 | |
10 | |
6 |