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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

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

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.