Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
HI, I tried so much and could not figure out, hope some one could help me!
I have a table with 4 columns:
Table: TableXYZ
id | user | gender | value |
1 | a | 1 | 10 |
2 | a | 2 | 5 |
3 | a | 1 | 10 |
4 | b | 0 | 1 |
5 | b | 2 | 1 |
6 | b | 1 | 5 |
7 | c | 1 | 6 |
What I want is with selecting different gender,
I could get a new measure 'sumvalue' to sum value for every user, I also could 'rank' user according their sumvalue. for example, if I select gender '1', I get:
user | gender | sumvalue | rank |
a | 1 | 20 | 1 |
b | 1 | 5 | 3 |
c | 1 | 6 | 2 |
I hope I explained it sufficiently and there is someone who could help!! thanks a lot!
Solved! Go to Solution.
@wei wrote:
Many thanks, Dog! I followed your suggestion and added measures and table visual, the result is as below. Seems SumofVaule is correct but Rank is not we wanted. More help needed!
This measure shall work.
Rank = RANKX ( ALLSELECTED ( TableXYZ ), CALCULATE ( SUM ( TableXYZ[value] ), ALLEXCEPT ( TableXYZ, TableXYZ[user], TableXYZ[gender] ) ), , DESC, DENSE )
Hi,
assuming I'm understanding correctly it sounds like you just need to create two new measures.
SumofValue:=SUM(value)
and
Rank:=RANKX(ALL(TableXYZ),[SumofValue],,DESC)
add table visual
add columns user and gender and measures SumofValue and Rank
then add a slicer onto page for gender.
does that help?
Dog
Many thanks, Dog! I followed your suggestion and added measures and table visual, the result is as below. Seems SumofVaule is correct but Rank is not we wanted. More help needed!
@wei wrote:
Many thanks, Dog! I followed your suggestion and added measures and table visual, the result is as below. Seems SumofVaule is correct but Rank is not we wanted. More help needed!
This measure shall work.
Rank = RANKX ( ALLSELECTED ( TableXYZ ), CALCULATE ( SUM ( TableXYZ[value] ), ALLEXCEPT ( TableXYZ, TableXYZ[user], TableXYZ[gender] ) ), , DESC, DENSE )
Hi,
Try
Rank:=RANKX(ALLSELECTED(TableXYZ),[SumofValue],,DESC)
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
72 | |
71 | |
38 | |
31 | |
27 |
User | Count |
---|---|
91 | |
49 | |
44 | |
39 | |
35 |