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
sbgsmith
Regular Visitor

Group Rows in a Table based on count

I have a visual showing counts of individuals by County. The data source has multiple rows for each individual and county so it is aggregated using Count Distinct on the County field.

 

The visual currently looks like this.

 

COUNTY            Individuals

KINGS2000
BRONX1500
NEW YORK1250
QUEENS1000
RICHMOND300
HUDSON1
ESSEX1
HENRICO1

 

I am looking to group all counties where the value is 1 together and call it "OTHER". I am looking for it to look like this, where Hudson, Essex and Henrico are relabled as "OTHER" and their combined count is shown.

COUNTY            Individuals

KINGS2000
BRONX1500
NEW YORK1250
QUEENS1000
RICHMOND300
OTHER3

 

The values can change, so I need this to be calculated not just selecting the 3 counties in a group.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @sbgsmith ,

Here are the steps you can follow:

1. Create calculated Table:.

Table 2 =
var _table1=
SUMMARIZE(
    'Table',
    "COUNTY","Other",
    "Individuals",
    SUM('Table'[Individuals]))
    return
    UNION('Table',_table1)

2. Create calculated column in Table2.

Individuals_Column =
IF(
    'Table 2'[COUNTY]="Other",
    CALCULATE(COUNTROWS('Table 2'),FILTER(ALL('Table 2'),'Table 2'[Individuals]=1))
    ,
    [Individuals])

vyangliumsft_0-1657503783136.png

3. Create calculated Table

Table 3 =
var _table1=
FILTER(
    'Table 2',
    'Table 2'[Individuals_Column]<>1)
return
SUMMARIZE(
    _table1,
    [COUNTY],[Individuals_Column])

4. Result:

vyangliumsft_1-1657503783137.png

If you need pbix, please click here.

 

Best Regards,

Liu Yang

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

1 REPLY 1
Anonymous
Not applicable

Hi  @sbgsmith ,

Here are the steps you can follow:

1. Create calculated Table:.

Table 2 =
var _table1=
SUMMARIZE(
    'Table',
    "COUNTY","Other",
    "Individuals",
    SUM('Table'[Individuals]))
    return
    UNION('Table',_table1)

2. Create calculated column in Table2.

Individuals_Column =
IF(
    'Table 2'[COUNTY]="Other",
    CALCULATE(COUNTROWS('Table 2'),FILTER(ALL('Table 2'),'Table 2'[Individuals]=1))
    ,
    [Individuals])

vyangliumsft_0-1657503783136.png

3. Create calculated Table

Table 3 =
var _table1=
FILTER(
    'Table 2',
    'Table 2'[Individuals_Column]<>1)
return
SUMMARIZE(
    _table1,
    [COUNTY],[Individuals_Column])

4. Result:

vyangliumsft_1-1657503783137.png

If you need pbix, please click here.

 

Best Regards,

Liu Yang

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

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