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.
Hello,
I have table consist of CustomerID, TransactionDate, WeekofYear. I want to DISTINCTCOUNT the customer based on 6 weeks before current week and display it in column chart. So if the column chart 47 week should look from week 42.
My Measure like this:
TotalCust =
CALCULATE(
DISTINCTCOUNT('CustomerID'),
WeekofYear >= MAX(WeekofYear) - 6 &&
WeekofYear <= MAX(WeekofYear)
)
I have tried like that but di value is just DISTINCTCOUNT the week in the current state. Is there anything false in my dax?
Hi @hani1711
Have you solved your problem? If so, can you share your solution here and mark the correct answer as a standard answer to help other members find it faster? Thank you very much for your kind cooperation!
Best Regards
Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
hi @hani1711 ,
try like:
TotalCust =
CALCULATE(
DISTINCTCOUNT('CustomerID'),
WeekofYear = MAX(WeekofYear) - 5
)
Hi @hani1711
Please refer to the linked video:
https://www.youtube.com/watch?v=0enQCIWCSUE
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
could you pls provide some sample data and expected output?
Proud to be a Super User!
hi ryan
here is the sample of data and what the expected value
Example:
1. For week 47 the value should be 3, because just the 3 customer in the last 6 week based on customer in week 47, cust 004 is excluded
2. For week 47 with the filter brand A the value should be 2, with the same reason
max week is 47 and 004 is in week 44, why not count 004 for last 6 weeks?
Proud to be a Super User!
because 004 isn't in week 47, the customer should be in the week 47 first before checking last 6 week
for the middle pivot table. if not in week 47, then even it exists in last 6 weeks, we don't want that. Why we need to check last 6 weeks?
Proud to be a Super User!
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.