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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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