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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
rpapier
New Member

Count number of active articles divided by country at the end of each week

Hi,

I'm stuck on how to count number of active articles divided by country at the end of each week. I have 2 tables - key in the relation is Article ID.

1=active, 0=inactive in [Active] column.

DateWeeknumActiveArticle ID
01-01-2022 521100
01-01-2022 521200
01-01-2022 521300
01-01-2022 521400
01-01-2022 521500
02-01-2022 520200
04-01-2022 10100
08-01-2022 10300
09-01-2022 11200
09-01-2022 10500
09-01-2022 11100
12-01-2022 20400
13-01-2022 20200
14-01-2022 21300
15-01-2022 20100
15-01-2022 21500
16-01-2022 21200
17-01-2022 30500
17-01-2022 30300
23-01-2022 31400

 

Article IDCountry
100UK
200USA
300UK
400USA
500DE


Output expected

Count Articles ActiveCountryWeeknum
2UK52
1USA52
1DE52
1UK1
2USA1
0DE1
1UK2
1USA2
1DE2
0UK3
2USA3
0DE3

 

1 REPLY 1
v-yiruan-msft
Community Support
Community Support

Hi @rpapier ,

What's the calculation logic of getting [Count Articles Active]? Could you please explain it base on your provided data and specific example? I created a sample pbix file(see the attachment), but there is difference with your expected output. I'm not sure what do you mean of "count number of active articles divided by country"... 

Count Articles Active = 
VAR _acount =
    CALCULATE ( COUNT ( 'Table1'[Article ID] ), 'Table1'[Active] = 1 )
RETURN
    _acount + 0

yingyinr_0-1673503975293.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.