The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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:
User | Count |
---|---|
16 | |
8 | |
6 | |
6 | |
5 |
User | Count |
---|---|
23 | |
13 | |
13 | |
8 | |
8 |