Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Rankx Ignoring visual filters

Hi All,

 

I am hoping someone can help me with the rankx dax measure.  Below is a sample table

 

SourceId

Symbol

Amount

Date

A

A

$7,888.50

01/01/20

B

A

$8,751.00

01/01/20

C

A

$970.75

01/01/20

A

B

$958.32

01/02/20

B

B

$1,303.35

01/02/20

C

B

$4,382.50

01/02/20

A

C

$1,022.00

01/03/20

B

C

$864.60

01/03/20

C

C

$432.10

01/03/20

 

What i would like to do is rank each symbol based on amount by exchange by symbol.  In other words i am ranking A's only against other A's, B's against other B's etc.  This would have to be dynamic where i can adjust the date and the numbers adjust accordingly.  It could be using the date column or a related calendar table.  I would aslo like to be able to insert a filter at the visual level without the rankings changing.    The bottom represents the info i am looking for I tried to attached a photo of the b visuals but i was getting an error so imagine the tables below as if there are 3 seperate BI table visuals.  Each visual would have a visual level filter for source ID.  Any help would greatly appreciated!

 

 
SymbolAmountRank SymbolAmountRank SymbolAmountRank
A7888.52 A87511 A970.753
B958.323 B1303.352 B4382.51
C10221 C864.62 C432.13
 
1 ACCEPTED SOLUTION
harshnathani
Community Champion
Community Champion

Hi @Anonymous ,

 

 

You can create 3 measures

 

RankSourceA = IF (MAX('Table'[SourceId]) = "A" ,RANKX(FILTER(ALL('Table'),'Table'[SourceId] = "A"),CALCULATE(SUM('Table'[Amount]))))
 
RankSourceB = IF (MAX('Table'[SourceId]) = "B" ,RANKX(FILTER(ALL('Table'),'Table'[SourceId] = "B"),CALCULATE(SUM('Table'[Amount]))))
 
RankSourceC = IF (MAX('Table'[SourceId]) = "C" ,RANKX(FILTER(ALL('Table'),'Table'[SourceId] = "C"),CALCULATE(SUM('Table'[Amount]))))
 
 
1.jpg
 
Regards,
Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

View solution in original post

1 REPLY 1
harshnathani
Community Champion
Community Champion

Hi @Anonymous ,

 

 

You can create 3 measures

 

RankSourceA = IF (MAX('Table'[SourceId]) = "A" ,RANKX(FILTER(ALL('Table'),'Table'[SourceId] = "A"),CALCULATE(SUM('Table'[Amount]))))
 
RankSourceB = IF (MAX('Table'[SourceId]) = "B" ,RANKX(FILTER(ALL('Table'),'Table'[SourceId] = "B"),CALCULATE(SUM('Table'[Amount]))))
 
RankSourceC = IF (MAX('Table'[SourceId]) = "C" ,RANKX(FILTER(ALL('Table'),'Table'[SourceId] = "C"),CALCULATE(SUM('Table'[Amount]))))
 
 
1.jpg
 
Regards,
Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.