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
michaeljhenley0
New Member

Rolling up a list via the most common value in a column

Hello,

 

I am relatively new to Power BI. I'm trying to create a list that surveys a large table full of contact, geographic and policy info.

 

I have two tables. Table 1 starts with a text string of State-County-Policy # and then invidual locations with individual contact names and numbers. Often, there are repeats.

 

State/County/PolicyLocationContact NameContact Number
AK-ANCHORAGE-00011GUY SMITH9999999999
AK-ANCHORAGE-00012GUY SMITH9999999999
AK-ANCHORAGE-00013GUY SMITH9999999999
AK-ANCHORAGE-00014DAVID SMITH8888888888
AK-ANCHORAGE-00015DAVID SMITH8888888888
AK-ANCHORAGE-00016DAVID SMITH8888888888
AK-ANCHORAGE-00027PETER SMITH7777777777
AK-ANCHORAGE-00028PETER SMITH7777777777
AK-ANCHORAGE-00029PHIL SMITH6666666666
AK-ANCHORAGE-000310JOHN SMITH5555555555

 

Table 2 is a summarized version of this first table where I want to roll up table 1 into one State-County-Policy instance per line, with the contact name and contact number populated by the most common value that occured in each of those columns for that state-county-policy combination.

 

State/County/PolicyContact NameContact Number
AK-ANCHORAGE-0001  
AK-ANCHORAGE-0002  
AK-ANCHORAGE-0003  

 

So, in other words I would want table 2 to look like this, selecting the most common values from filtering table 1 via the state/county/policy.

 

State/County/PolicyContact NameContact Number
AK-ANCHORAGE-0001GUY SMITH9999999999
AK-ANCHORAGE-0002PETER SMITH7777777777
AK-ANCHORAGE-0003JOHN SMITH5555555555

 

Is this possible?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @michaeljhenley0 ,

You can create a calculated table as below:

Table 2 = 
VAR _table =
    SUMMARIZE (
        'Table',
        'Table'[State/County/Policy],
        'Table'[Contact Name],
        'Table'[Contact Number],
        "countofcn", CALCULATE ( COUNT ( 'Table'[Contact Number] ) )
    )
VAR _table2 =
    ADDCOLUMNS (
        _table,
        "maxcount",
            MAXX (
                FILTER ( _table, [State/County/Policy] = EARLIER ( [State/County/Policy] ) ),
                [countofcn]
            )
    )
VAR _table3 =
    SUMMARIZE (
        FILTER ( _table2, [countofcn] = [maxcount] ),
        [State/County/Policy],
        [Contact Name],
        [Contact Number]
    )
RETURN
    _table3

yingyinr_1-1623740922615.png

Best Regards

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @michaeljhenley0 ,

You can create a calculated table as below:

Table 2 = 
VAR _table =
    SUMMARIZE (
        'Table',
        'Table'[State/County/Policy],
        'Table'[Contact Name],
        'Table'[Contact Number],
        "countofcn", CALCULATE ( COUNT ( 'Table'[Contact Number] ) )
    )
VAR _table2 =
    ADDCOLUMNS (
        _table,
        "maxcount",
            MAXX (
                FILTER ( _table, [State/County/Policy] = EARLIER ( [State/County/Policy] ) ),
                [countofcn]
            )
    )
VAR _table3 =
    SUMMARIZE (
        FILTER ( _table2, [countofcn] = [maxcount] ),
        [State/County/Policy],
        [Contact Name],
        [Contact Number]
    )
RETURN
    _table3

yingyinr_1-1623740922615.png

Best 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