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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Finding number of active sites based on date

I have a table with data concercing sites (physical locations) and status changes in which sitestat_id 'A' stands for active, sample:

 

site_nositestat_idchange_date
661740A3-8-2020 11:21:00
661740C3-7-2020 11:19:00
24204A3-7-2020 11:14:00
24204C31-6-2020 15:16:00
8809A31-6-2020 13:18:00
8809C23-5-2020 12:43:00
663577A21-5-2020 09:29:00
48768R19-5-2020 15:16:00

 

I also have a (currently disconnected) date table.

 

I'm looking for a way to write a measure which shows the number / count of active (A) sites per month in a table, based on the site status on the last day of the month.

 

I also would like a measure whichs works based on a date slicer.

 

Open to other solutions than measures as well.

5 REPLIES 5
Anonymous
Not applicable

Thank you for your replies guys 🙂

 

@harshnathani,

That doesn't yield the exact result I'm looking for. I think it counts the number of new active sites while I'm also looking for already active sites. E.g. the count for September 2019 should also list sites that became active in August and July.

 

Also forgot to mention I meant month + year instead of just month.

 

@amitchandak,

 

That does seem like something that should work but it currently doesn't. MAXX() needs two arguments. I would like to adjust but I can't wrap my head around it yet. What do St and Ed do?

Anonymous
Not applicable

@Anonymous 

Try add DATESMTD in the measure:

Measure = CALCULATE(COUNT('Table'[site_no]), FILTER('Table',[sitestat_id] = "A"),DATESMTD('Date'[Date]))


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

Anonymous
Not applicable

@Anonymous 
@amitchandak 
@harshnathani 

I'm looking for something cumulative, but it shouldn't count it if the value closest (but before) to the desired date isn't "A". I know it should be possible but it really has me stumped.

amitchandak
Super User
Super User

@Anonymous , Try like

countx(filter(summarize(Table, table[site_no], "St", calculate(Min(Table[change_date]),table[sitestat_id]="A"), "Ed", calculate(Min(Table[change_date]),table[sitestat_id]="C")
) ,[St] <= maxx(Date[DAte]) && [Ed]>= maxx(Date[DAte])),[site_no])

 

Assumed Date is disconnected table

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
harshnathani
Community Champion
Community Champion

Hi @Anonymous ,

 

 

Create a month Column

 

_Month = MONTH(change_date)

 

Then create a measure

 

_CountM  = CALCULATE(COUNT('Table'[site_no]), site_stat = "A")

 

Regards,

Harsh Nathani

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors