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
sharon_net
Frequent Visitor

How to create a table from the unique value pairs found in an existing table?

sharon_net_0-1702737607095.png

The data model being used is pasted above.

 

I am trying to create a table that contain unique pairs of Borough and incident_count from crime_report table.

 

I tried create a table of distinct borough values -

crimes_by_borough = DISTINCT(crime_report[Borough])
and then adding the incident_count
incident_count = VALUE(crime_report[incident_count], crimes_by_borough[Borough]=crime_report[Borough])
 
Could someone please help me with this?
 
 
 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @sharon_net ,

You can create a calculated table as below to get it:

Table =
SUMMARIZE (
    'crime_report',
    'crime_report'[LSOA Code],
    "incident_count", SUM ( 'crime_report'[incident_count] )
)

vyiruanmsft_0-1703150201367.png

In addition,  you can create a Table visual with below Fields settings to get it directly...

vyiruanmsft_2-1703150330430.png

Best Regards

View solution in original post

4 REPLIES 4
sharon_net
Frequent Visitor

 Hi,

 

my dataset is in the form of a CSV-

 

here is a snippet

 

LSOA Code,LSOA Name,Borough,Major Category,Minor Category,incident_count
E01000008,Barking and Dagenham 016A,E09000002,Arson and Criminal Damage,Criminal Damage,10
E01000009,Barking and Dagenham 016A,E09000002,Burglary,Domestic Burglary,7
E01000009,Barking and Dagenham 016A,E09000002,Drug Offences,Drug Trafficking,5


 

 

I'm expecting a table that sums up the incident counts per borough, since there could be multiple records with the same borough

 

Result expected is

 

Borough | incident_count

E000008| 10

E000009|12

 

Anonymous
Not applicable

Hi @sharon_net ,

You can create a calculated table as below to get it:

Table =
SUMMARIZE (
    'crime_report',
    'crime_report'[LSOA Code],
    "incident_count", SUM ( 'crime_report'[incident_count] )
)

vyiruanmsft_0-1703150201367.png

In addition,  you can create a Table visual with below Fields settings to get it directly...

vyiruanmsft_2-1703150330430.png

Best Regards

Hi,

To a Table visual, drag Borough and write this measure

Total = sum(Data[incident_count])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ritaf1983
Super User
Super User

Hi @sharon_net 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

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