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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Adammhm
New Member

Get list of values from the second most occurrences

Hi there,

 

I have 2 fields - Incident Type and Department: I am trying to display a table that lists the incident type for the second most occur department. 

Incident TypeDepartment
AX
BX
CX
CX
D

Y

D

Y

E

Y

 

I would like to get a table that shows:

 

Incident TypeCount of Incident type
D2
E1

 

Is this achievable? Thanks in advance

1 ACCEPTED SOLUTION
v-angzheng-msft
Community Support
Community Support

Hi, @Adammhm 

Try to create a measure like this:

Rank = 
RANKX(ALL('Table'),CALCULATE(COUNT('Table'[Incident Type]),ALLEXCEPT('Table','Table'[Department])),,DESC,Dense)

And to show items when measure is 2.
Result:

vangzhengmsft_0-1643006152099.png

Please refer to the attachment below for details.

Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng

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
v-angzheng-msft
Community Support
Community Support

Hi, @Adammhm 

Try to create a measure like this:

Rank = 
RANKX(ALL('Table'),CALCULATE(COUNT('Table'[Incident Type]),ALLEXCEPT('Table','Table'[Department])),,DESC,Dense)

And to show items when measure is 2.
Result:

vangzhengmsft_0-1643006152099.png

Please refer to the attachment below for details.

Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Adammhm , Create measure like these

 


cnt = count(table[Department])


rank = rankx(allselected(Table[Incident Type]), [cnt],,desc,dense)

 

Rank2 = sumx(filter(values(Table[Incident Type]) , [Rank] =2), [cnt])

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

Does this work with date slicer?

Hi @amitchandak ,

 

Thank you for the prompt response. I have created the measures as you suggested and have Incident type and Count of Incident Type in the Values, and [Rank2] placed in the filters on this visual. The table didn't filter out other incident types. Sorry if I have done it incorrectly, I'm new to Power BI. 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors