Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hello,
I have a table that has ID, Name, date, ......, lead_source. I'm trying to find the name of the lead_source with the most ID's to put in a card. Need help with the code....Thanks.
Hi @aashton ,
create a table using this:
Measure = 
var _table =
TOPN(1,
Summarize 
(
'Table (2)',
'Table (2)'[Lead_Source],
"Max ids", SUM('Table (2)'[ID])
),
[Max ids],DESC
)
return
_table
create this measure=
Measure = 
SELECTEDVALUE( 'Measure'[Lead_Source])
let me know if this resolves the problem.
Appreciate a thumbs up if this is helpful.
hi @aashton
please try like:
lead_source with the most ID = 
VAR _list = VALUES(TableName[lead_source])
VAR _MaxID =
MAXX(
    _list,
    CALCULATE(COUNTROWS(TableName))
)
RETURN
FILTER(
    _list,
    CALCULATE(COUNTROWS(TableName) = _MaxID)
)
verified with a simplified sample data and it worked like this:
sample data:
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
            | User | Count | 
|---|---|
| 8 | |
| 5 | |
| 5 | |
| 4 | |
| 3 | 
| User | Count | 
|---|---|
| 24 | |
| 11 | |
| 10 | |
| 9 | |
| 8 |