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!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi!
I'm currently stuck on this what i believe should be a simple endevour.
I am trying to count the duplicates Names within a table and i have a solution for that. Although, i want to count the duplicates from last week only.
Lets say i have week 24,25 & 26 data within my table. I only want to count the duplicates from week 25. Everything else should be blank or recieve zero value.
I've tried several ways but i still get values on all the weeks.
Help would be much appreciated!
-------------------------------------------------------------------------------------------------------------------------------------
Here is my working solution for all weeks:
Count Names 2 =
var Names = Sheet1[Name]
var SelectedDate = MAX(Sheet1[Week])
var PreviousWeek = SelectedDate -1
RETURN
CALCULATE(
COUNTROWS('Sheet1'),
CALCULATETABLE(all('Sheet1')),
'Sheet1'[Name] = Names && 'Sheet1'[Week] = PreviousWeek
)
Kind Regards
D
Solved! Go to Solution.
Hi @Anonymous ,
Please remove the ALL() filter:
New measure =
var SelectedDate = MAXX(allselected(Sheet1), Sheet1[Week])
var PreviousWeek = SelectedDate -1
RETURN
CALCULATE(
COUNTROWS('Sheet1'),
filter('Sheet1',
'Sheet1'[Name] = max('Sheet1'[Name] ) && 'Sheet1'[Week] = PreviousWeek
)
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
Please remove the ALL() filter:
New measure =
var SelectedDate = MAXX(allselected(Sheet1), Sheet1[Week])
var PreviousWeek = SelectedDate -1
RETURN
CALCULATE(
COUNTROWS('Sheet1'),
filter('Sheet1',
'Sheet1'[Name] = max('Sheet1'[Name] ) && 'Sheet1'[Week] = PreviousWeek
)
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi and thank you for your response!
Worked like a charm. Much obliged!
Hi @Anonymous
Would you please share a screenshot that illustrates the expected result. Thank you
@Anonymous , Try like
New measure =
var SelectedDate = MAXX(allselected(Sheet1), Sheet1[Week])
var PreviousWeek = SelectedDate -1
RETURN
CALCULATE(
COUNTROWS('Sheet1'),
filter(all('Sheet1'),
'Sheet1'[Name] = max('Sheet1'[Name] ) && 'Sheet1'[Week] = PreviousWeek
)
Also it is better to use a separate year week table or date table with week rank
New columns
Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense)
OR
Week Rank = RANKX(all('Date'),'Date'[Year Week],,ASC,Dense) //YYYYWW format
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-Last-Week/ba-p/1051123
https://www.youtube.com/watch?v=pnAesWxYgJ8
Hi @amitchandak and thanks for your reply.
Result with your measure:
It shows correct values now, however. The other weeks are also calulated by themselves.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!