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!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hi Expert,
I have one Date Range Slicer and As per the range selection it will calculate the Sale of the entire week data of that selected range.
For Example,
If User Selects End Range 4th, Aug 2022 so it will return Sales value of 1-4 Aug.
Week should be considered as Monday to Sunday.
Please help me to calculate this using DAX.
Solved! Go to Solution.
Hi @Uzi2019 ,Try this:
Create Week No Column:
Week No = WEEKNUM('TableName'[DateColumn],2)
Then create another column for Week Ranking:
Week Rank = RANKX(ALL('TableName'),'TableName'[Week No],,ASC)
Then last step is to create a measure like below:
Current Week =
VAR latestWeek = CALCULATE(MAX('TableName'[Week Rank]),ALLSELECTED('TableName'))
VAR Result_ = CALCULATE(AVERAGE('TableName'[Sales]),FILTER('TableName','TableName'[Week Rank]=latestWeek))
RETURN Result_
Hi @Uzi2019 ,Try this:
Create Week No Column:
Week No = WEEKNUM('TableName'[DateColumn],2)
Then create another column for Week Ranking:
Week Rank = RANKX(ALL('TableName'),'TableName'[Week No],,ASC)
Then last step is to create a measure like below:
Current Week =
VAR latestWeek = CALCULATE(MAX('TableName'[Week Rank]),ALLSELECTED('TableName'))
VAR Result_ = CALCULATE(AVERAGE('TableName'[Sales]),FILTER('TableName','TableName'[Week Rank]=latestWeek))
RETURN Result_
Hi @Tahreem24 ,
Thanks alot. Your solution works for me.
@Uzi2019 , Create a date table with following columns
new columns
Week Start date = 'Date'[Date]+-1*WEEKDAY('Date'[Date],2)+1
Week End date = 'Date'[Date]+ 7-1*WEEKDAY('Date'[Date],2)
Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense)
OR
Week Rank = RANKX(all('Date'),'Date'[Year Week],,ASC,Dense) //YYYYWW format
weekday = weekday([date],2)
Then measures like
WTD = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank]) && 'Date'[WeekDay]<=max('Date'[WeekDay])-1))
LWTD = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1 && 'Date'[WeekDay]<=max('Date'[WeekDay])-1 ))
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
Hi @amitchandak
I tried your solution it did not work.Do yu have any other way of doing it?
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.