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
akarasick1
Frequent Visitor

Count all *other* records excluding current record; consider blank values

In the bottom visual below, you'll notice answers of "6", but I'm looking for an answer of "8". Below I describe the setup:

 

In my "Store" table, notice the empty values for Store Name

akarasick1_2-1594691781651.png

 

I am trying to count how many other stores there are when I look at one store name (middle visual). I'm trying to use the following measure:

Count of All Other Store =
var __selection = SELECTEDVALUE(Stores[Store Name])
var __table = FILTER(ALLSELECTED(Stores),Stores[Store Name]<>__selection)
return
COUNTROWS(__table)

 

akarasick1_3-1594691789814.png

 

 

Thanks!

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@akarasick1 , do not use store name, Try to take store id and advantage of row context

calculate(count(Stores[Store_id]),filter(all(Stores), Stores[Store_id]<>max(Stores[Store_id])))

or

calculate(count(Stores[Store_id]),filter(all(Stores[Store_id]), Stores[Store_id]<>max(Stores[Store_id])))

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@akarasick1 , do not use store name, Try to take store id and advantage of row context

calculate(count(Stores[Store_id]),filter(all(Stores), Stores[Store_id]<>max(Stores[Store_id])))

or

calculate(count(Stores[Store_id]),filter(all(Stores[Store_id]), Stores[Store_id]<>max(Stores[Store_id])))

AntrikshSharma
Community Champion
Community Champion

I am getting the correct count, Is there any other filter active on the report?

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.

Top Solution Authors