cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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

Accepted Solutions
Highlighted
Super User IX
Super User IX

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

@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])))



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

2 REPLIES 2
Highlighted
Super User II
Super User II

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

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

Thank you,
Antriksh Sharma
Highlighted
Super User IX
Super User IX

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

@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])))



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

Helpful resources

Announcements

August Community Highlights

Check out a full recap of the month!

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.