Forum Discussion
Count and Rank Please
- Anonymous3 years ago
hello Sudhakar510
i created a sample datathe uncessary column is just an added column so the allexcept later on works, because i would assume you have more than those 2 columns
for table A with only values,use :Count of Items alone = CALCULATE(COUNT(Help[Value]),ALLEXCEPT(Help,Help[Value]))and for ranking
table 1 rank = VAR __currentvalue = MAX(Help[Value]) VAR __tmpTable = ALL(Help) VAR __tmpTable1 = SUMMARIZE(__tmpTable,Help[Value],"__Count",[Count of Items alone]) VAR __tmpTable2 = ADDCOLUMNS(__tmpTable1,"__Rank",RANKX(__tmpTable1,[__Count],,DESC,Dense)) RETURN MAXX(FILTER(__tmpTable2,Help[Value]=__currentvalue),[__Rank])
now for table B:count of item per id = CALCULATE(COUNT(Help[Value]),ALLEXCEPT(Help,Help[ID],Help[Value]))but if you only have those 2 columns , id and value, use
count of item per id = CALCULATE(COUNT(Help[Value]))for ranking:
table 2 rank = VAR __currentid = MAX(Help[ID]) VAR __currentvalue = MAX(Help[Value]) VAR __tmpTable = ALL(Help) VAR __tmpTable1 = SUMMARIZE(__tmpTable,Help[Value],Help[ID],"__Count",[count of item per id]) VAR __tmpTable2 = ADDCOLUMNS(__tmpTable1,"__Rank",RANKX(__tmpTable1,[__Count],,DESC,Dense)) RETURN MAXX(FILTER(__tmpTable2,AND(Help[Value]=__currentvalue,Help[ID] = __currentid)),[__Rank])if i solved you problem, a kudos is well appreciated as well as mark it as solved
hello Sudhakar510
i created a sample data
the uncessary column is just an added column so the allexcept later on works, because i would assume you have more than those 2 columns
for table A with only values,use :
Count of Items alone = CALCULATE(COUNT(Help[Value]),ALLEXCEPT(Help,Help[Value]))
and for ranking
table 1 rank =
VAR __currentvalue = MAX(Help[Value])
VAR __tmpTable = ALL(Help)
VAR __tmpTable1 = SUMMARIZE(__tmpTable,Help[Value],"__Count",[Count of Items alone])
VAR __tmpTable2 = ADDCOLUMNS(__tmpTable1,"__Rank",RANKX(__tmpTable1,[__Count],,DESC,Dense))
RETURN MAXX(FILTER(__tmpTable2,Help[Value]=__currentvalue),[__Rank])
now for table B:
count of item per id = CALCULATE(COUNT(Help[Value]),ALLEXCEPT(Help,Help[ID],Help[Value]))
but if you only have those 2 columns , id and value, use
count of item per id = CALCULATE(COUNT(Help[Value]))
for ranking:
table 2 rank =
VAR __currentid = MAX(Help[ID])
VAR __currentvalue = MAX(Help[Value])
VAR __tmpTable = ALL(Help)
VAR __tmpTable1 = SUMMARIZE(__tmpTable,Help[Value],Help[ID],"__Count",[count of item per id])
VAR __tmpTable2 = ADDCOLUMNS(__tmpTable1,"__Rank",RANKX(__tmpTable1,[__Count],,DESC,Dense))
RETURN MAXX(FILTER(__tmpTable2,AND(Help[Value]=__currentvalue,Help[ID] = __currentid)),[__Rank])
if i solved you problem, a kudos is well appreciated as well as mark it as solved