Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
noamshn
Frequent Visitor

how to count different records in every week in every year?

hello everyone,

I have thie measure:

Completed In every year (Week) = CALCULATE(
COUNTROWS('Intelex'),
USERELATIONSHIP(WeekDates[WeekNum],'Intelex'[Week Completed]),
'Intelex'[Status]="Closed"
) + 0


the problem is that it counts the records from all the years for a single week. let's say i have week number 1, it counts the records from year 2022, 2023 and 2024 this week. I want it to count the records in week number 1 in 2022, week number 1 in 2023 and week number 1 in 2024.

what am i doing wrong? how can i solve it?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @noamshn ,

 

I created some data:

Intelex:

vyangliumsft_0-1705315108367.png

WeekDates:

vyangliumsft_1-1705315108368.png

 

Here are the steps you can follow:

1. Create measure.

Measure =
var _select=SELECTEDVALUE('WeekDates'[WeekNum])
return
COUNTX(
    FILTER(ALL(Intelex),
    'Intelex'[Week Completed]=_select&&'Intelex'[Week Completed]=MAX('WeekDates'[WeekNum])&&'Intelex'[Status]="Closed"),[Date])

2. Result:

vyangliumsft_2-1705315142315.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi  @noamshn ,

 

I created some data:

Intelex:

vyangliumsft_0-1705315108367.png

WeekDates:

vyangliumsft_1-1705315108368.png

 

Here are the steps you can follow:

1. Create measure.

Measure =
var _select=SELECTEDVALUE('WeekDates'[WeekNum])
return
COUNTX(
    FILTER(ALL(Intelex),
    'Intelex'[Week Completed]=_select&&'Intelex'[Week Completed]=MAX('WeekDates'[WeekNum])&&'Intelex'[Status]="Closed"),[Date])

2. Result:

vyangliumsft_2-1705315142315.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Anonymous
Not applicable

As per what I see looking at this measure and your requirement. All you need now is a date table and a slicer with year column in it. I think you'll be able to filter out the based on that. 

Thankyou.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.