Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
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: