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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Modification to metric: "Summary table with calculated columns"

Hi everyone, I'm hoping someone can assist with a modificaton to an existing metric.

 

I originally had a table with lots of data - 1 million+ lines. Each line in the table showed a ticket ID (RefNum), an activity that occurred within each ticket (ActivityType), and a datestamp for that activity (DateActivityCreated). There were potentially multiple lines for each RefNum, and each line is in no particular order. There is also a 'Customer' column. Example below:

CustomerRefNumActivityTypeDateActivityCreated
Google1054976Search19/02/2019 9:59
Google1054976Link19/02/2019 9:59
Microsoft1054675Reopened19/02/2019 9:58
Microsoft1054675Resolved19/02/2019 9:59
Microsoft1054675Field Updated30/04/2019 8:44
Microsoft1054675Field Updated11/07/2019 12:12
Apple1251685Other11/07/2019 12:11
Google1290806Search7/02/2019 14:09
Google1290806Field Updated7/02/2019 14:05
Google1290806Field Updated7/02/2019 14:07
Google1290806Link7/02/2019 14:06
Google1290806Other7/02/2019 14:06
Google1290806Reopened7/02/2019 14:05
Google1290806Resolved7/02/2019 14:09
Google1290806Status Changed7/02/2019 14:06
Microsoft1294302Search15/03/2019 14:40
Apple1296581Search11/03/2019 13:57
Apple1296581Field Updated11/03/2019 13:57
Apple1296581Field Updated11/03/2019 13:57

 

I wanted to be able to create a summary table that showed single instances of each individual RefNum per line, and additional columns for Search, Link, Knowledge Gap, and No Search No Link. Here's how the information in those columns should have been calculated:

 

  • Search = Any ticket that contains at least one 'Search' ActivityType should show the text "Search"
  • Link = Any ticket that contains at least one 'Link' ActivityType should show the text "Link"
  • Knowledge Gap = Any ticket that contains at least one 'Search' ActivityType and does NOT contain at least one 'Link' ActivityType should show the text "Knowledge Gap"
  • No Search No Link = Any ticket that does not contain a 'Search' and 'Link' ActivityType should show the text "No Search No Link"

Here is the data I had expected to see, based on the table above:

 

RefNumSearchLinkKnowledge GapNo Search No Link
1054976SearchLink  
1054675   No Search No Link
1251685   No Search No Link
1290806SearchLink  
1294302Search Knowledge Gap 
1296581Search Knowledge Gap 

 

A kind person gave me this solution, which worked great:

 

 

Table 2 = 
ADDCOLUMNS(
SUMMARIZECOLUMNS(
    'Table'[RefNum] ,
    "Search" , IF(COUNTROWS(FILTER('Table','Table'[ActivityType]="Search")),"Search","") ,
    "Link" , IF(COUNTROWS(FILTER('Table','Table'[ActivityType]="Link"))>0,"Link","") 
    ),
    "Knowledge Gap",IF([Search]="Search" && [Link]="","Knowledge Gap",""),
    "No Search No Link" , IF([Search]="" && [Link]="","No Search No Link","")
    )

 

 

 

But I'd like some help in modifying the above metric, so that I get the result below. Basically I want to include the bolded column in the summary table, which wasn't specified in my original request:

CustomerRefNumSearchLinkKnowledge GapNo Search No Link
Google1054976SearchLink  
Microsoft1054675   No Search No Link
Apple1251685   No Search No Link
Google1290806SearchLink  
Microsoft1294302Search Knowledge Gap 
Apple1296581Search Knowledge Gap 


I'd really appreciate some help!

1 ACCEPTED SOLUTION
JasonTX
Resolver I
Resolver I

What happens if you try something like this?

 

Table 2 = 
ADDCOLUMNS(
SUMMARIZECOLUMNS(
    'Table'[Customer] , 
    'Table'[RefNum] ,
    "Search" , IF(COUNTROWS(FILTER('Table','Table'[ActivityType]="Search")),"Search","") ,
    "Link" , IF(COUNTROWS(FILTER('Table','Table'[ActivityType]="Link"))>0,"Link","") 
    ),
    "Knowledge Gap",IF([Search]="Search" && [Link]="","Knowledge Gap",""),
    "No Search No Link" , IF([Search]="" && [Link]="","No Search No Link","")
    )

 

View solution in original post

2 REPLIES 2
JasonTX
Resolver I
Resolver I

What happens if you try something like this?

 

Table 2 = 
ADDCOLUMNS(
SUMMARIZECOLUMNS(
    'Table'[Customer] , 
    'Table'[RefNum] ,
    "Search" , IF(COUNTROWS(FILTER('Table','Table'[ActivityType]="Search")),"Search","") ,
    "Link" , IF(COUNTROWS(FILTER('Table','Table'[ActivityType]="Link"))>0,"Link","") 
    ),
    "Knowledge Gap",IF([Search]="Search" && [Link]="","Knowledge Gap",""),
    "No Search No Link" , IF([Search]="" && [Link]="","No Search No Link","")
    )

 

Anonymous
Not applicable

Much obliged @JasonTX , thank you 🙂

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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