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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
LeoQ
Helper I
Helper I

Detect when a distinct count exceeds a number.

Hi everybody, I spent lot of hours looking for a solution but I found nothing.

I have this table, that's made by a form completition. Each request might be made by different departments and might be solved by more than 1 agent. 

 

Whay I need is to detect when a request was made by 3 or more deparments and how many requests of this kind were solved by each agent. 

For example, John has 2 request of this kind (N° 5 & 7). 

I also have a date column, so it would be nice to filter by month as well.

 

Request IDDepartmentAgent
1Customer ServiceJohn
1Customer ServiceDiana
2TechnicalJohn
3SalesDiana
3LegalDiana
4SalesDiana
5Customer ServiceJohn
5Customer ServiceDiana
5TechnicalJohn
5TechnicalDiana
5SalesJohn
5SalesDiana
6TechnicalMary
7Customer ServiceJohn
7TechnicalJohn
7SalesJohn
7LegalJohn

 

Thanks in advance for your time!

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Picture1.png

 

Requests Count made by three dept or more : =
VAR _newtable =
ADDCOLUMNS (
SUMMARIZE ( Data, Requests[Request ID] ),
"@deptcount", CALCULATE ( COUNTROWS ( DISTINCT ( Data[Department] ) ) )
)
VAR _filtertable =
FILTER ( _newtable, [@deptcount] >= 3 )
VAR _summarizefilteredtable =
SUMMARIZE ( _filtertable, Requests[Request ID] )
RETURN
IF ( HASONEVALUE ( Agents[Agent] ), COUNTROWS ( _summarizefilteredtable ) )
 
Requests List made by three dept or more : =
VAR _newtable =
ADDCOLUMNS (
SUMMARIZE ( Data, Requests[Request ID] ),
"@deptcount", CALCULATE ( COUNTROWS ( DISTINCT ( Data[Department] ) ) )
)
VAR _filtertable =
FILTER ( _newtable, [@deptcount] >= 3 )
VAR _summarizefilteredtable =
SUMMARIZE ( _filtertable, Requests[Request ID] )
RETURN
IF ( HASONEVALUE ( Agents[Agent] ), CONCATENATEX( _summarizefilteredtable, Requests[Request ID], ", " ) )
 
 
 
 
 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

6 REPLIES 6
Jihwan_Kim
Super User
Super User

Picture1.png

 

Requests Count made by three dept or more : =
VAR _newtable =
ADDCOLUMNS (
SUMMARIZE ( Data, Requests[Request ID] ),
"@deptcount", CALCULATE ( COUNTROWS ( DISTINCT ( Data[Department] ) ) )
)
VAR _filtertable =
FILTER ( _newtable, [@deptcount] >= 3 )
VAR _summarizefilteredtable =
SUMMARIZE ( _filtertable, Requests[Request ID] )
RETURN
IF ( HASONEVALUE ( Agents[Agent] ), COUNTROWS ( _summarizefilteredtable ) )
 
Requests List made by three dept or more : =
VAR _newtable =
ADDCOLUMNS (
SUMMARIZE ( Data, Requests[Request ID] ),
"@deptcount", CALCULATE ( COUNTROWS ( DISTINCT ( Data[Department] ) ) )
)
VAR _filtertable =
FILTER ( _newtable, [@deptcount] >= 3 )
VAR _summarizefilteredtable =
SUMMARIZE ( _filtertable, Requests[Request ID] )
RETURN
IF ( HASONEVALUE ( Agents[Agent] ), CONCATENATEX( _summarizefilteredtable, Requests[Request ID], ", " ) )
 
 
 
 
 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Wow! You are awesome!

Thanks a lot for taking the time to create de pbix file. It wordked perfectly.

What function do you recommend if, instead of showing all the IDs concatenated, I show them in a multiple row card or another table.

Thanks again!

Hi,

Thank you for your feedback.

I am not sure how you want to see your final outcome, but please check the below picture and the link to the sample pbix file.

 

Picture1.png

 

 

Link to the sample pbix file 

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

It worked perfectly! Thanks a lot for your  time.

aj1973
Community Champion
Community Champion

Hi @LeoQ 

You want something that looks like this?

aj1973_0-1630334989377.png

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Thanks for your time! I need to know how many requests with 3 or more departments solved each agent. Fortunately I got the solution. 

Regards!

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