cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
harshadrokade
Post Patron
Post Patron

Getting count of values that are selected on slicer

I have a column as 'NAme of the company' & I have created a slicer based on this column. 

 

I have another column as 'secondary company'. 

 

I added a card visual & on that I want to show the count of secondary company that is selected in the slicer.

 

If I selected company A on slicer & the company A is appearing 10 times in column Secondary company, I want the card to show the count as 10 as company A is available 10 times in 'Secondary company' column.

2 ACCEPTED SOLUTIONS

Hi @harshadrokade ,

 

Try this measure:

 

Count = CALCULATE(COUNT('Company data'[Secondary company]),ALLEXCEPT('Company data','Company data'[Secondary company]),'Company data'[Secondary company]=SELECTEDVALUE('Company data'[Main company]))
 
If I answered your question, please mark it as a solution to help other members find it more quickly.

View solution in original post

Hi @harshadrokade ,

 

Not 100% sure if it works but you could try this:

Count = 
var Count = CALCULATE(COUNT('Company data'[Secondary company]),ALLEXCEPT('Company data','Company data'[Secondary company]),'Company data'[Secondary company]=SELECTEDVALUE('Company data'[Main company]))
Return
IF(Count=Blank(),"NA",Count)

View solution in original post

6 REPLIES 6
harshadrokade
Post Patron
Post Patron

@jppv20 One more query sir. When I select a single company in slicer, it provides me the count of secondary comnpanies very well but when I select All option in the slicer, it throws (Blank) in the card visual where I used this measure. HOw to edit the measure so that it shows 'NA' when I select All option in slicer

Hi @harshadrokade ,

 

Not 100% sure if it works but you could try this:

Count = 
var Count = CALCULATE(COUNT('Company data'[Secondary company]),ALLEXCEPT('Company data','Company data'[Secondary company]),'Company data'[Secondary company]=SELECTEDVALUE('Company data'[Main company]))
Return
IF(Count=Blank(),"NA",Count)

jppv20
Solution Sage
Solution Sage

Hi @harshadrokade ,

 

Could you provide some example data?

Hi @jppv20 I can't uplod original data due to restrictions but pls see below example.

 

See below data. I have single table having two columns as below. I will create a slicer based on Main company column & when I select a company out of it, it should give me count of rows for the same company in column Secondary company.

 

If I select company A in slicer, the card visual will show count as 4.

If I select company B in slier, the card visual will show count as 2.

 

Table - Company data

Column - Main company

A

B

C

D

E

D

E

F

 

 

Table - Company data

Column - Secondary company

A

A

A

A

B

B

C

C

C

D

D

E

D

E

F

F

F

F

F

G

G

G

G

Hi @harshadrokade ,

 

Try this measure:

 

Count = CALCULATE(COUNT('Company data'[Secondary company]),ALLEXCEPT('Company data','Company data'[Secondary company]),'Company data'[Secondary company]=SELECTEDVALUE('Company data'[Main company]))
 
If I answered your question, please mark it as a solution to help other members find it more quickly.

@jppv20 You are Awesome. This is working. God bless you man.

Helpful resources

Announcements
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors