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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Tevon713
Helper IV
Helper IV

Count number of sites in a region

Hi. I have simple table with sites and region. Struggling to count number of sites per region. So when user select region it count return number of sites. Will this able to flex if I add a site slicer as well.

 

Here's sample table with data.

 

Tevon713_0-1654720026805.png

1 ACCEPTED SOLUTION

Hi @Tevon713 ,

 

Please try these measrues.

 

Average of Select Region = 
AVERAGEX ( ALLSELECTED ( 'Test 1' ), [Sum Machine Count] )
Static Average ALL =
AVERAGEX ( ALL ( 'Test 1' ), [Sum Machine Count] )

vkkfmsft_0-1655176482420.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
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

4 REPLIES 4
tackytechtom
Super User
Super User

Hi @Tevon713 ,

 

I might misunderstand the query, but wouldn't it work with an ordinary Measure = COUNTROWS('table')

 

Anytime you select a region in a slicer, it will automatically just count the rows (= Sites) that exist for that region.

 

If in your table occurs the same site multiple times in a region, I'd recommend a DISTINCTCOUNT ('table'[site])

 

Let me know if this helps 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Thanks @tackytechtom for your quick reply. Sorry I didn't specify more. You correct in the countrows. I want to flex it count the site, then use in other calculation ie average of select region and static average for all. Maybe it in select avg and static avereage measures... giving incorrect output. I thought for moment I it was in the count.

 

Here the sample pbix.

https://www.dropbox.com/s/egipxxknpww4eew/Count%20Site%20per%20region.pbix?dl=0

 

When no filter are selected static average is correct.

Tevon713_2-1654723503462.png

 

When selecting a region select... incorrect for static average, average of select is correct... when site selected both are incorrect.

 

Tevon713_1-1654723401433.png

Hi @Tevon713 ,

 

Please try these measrues.

 

Average of Select Region = 
AVERAGEX ( ALLSELECTED ( 'Test 1' ), [Sum Machine Count] )
Static Average ALL =
AVERAGEX ( ALL ( 'Test 1' ), [Sum Machine Count] )

vkkfmsft_0-1655176482420.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you @v-kkf-msft. Your solution work.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.