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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

RankX by Category and by currently selected values.

Aktuell muss ich für jedes einzelne Measures eine eigene Rankx Measure schreiben, um mir die Top10 Dimensionen anzeigen zu lassen. Gibt es auch die Möglichkeit diese Formel so anzupassen, dass der Rank immer auf das aktuelle Value was im Visual angezeigt wird zu berechnet?

 

Rank dimension= IF (ISINSCOPE( 'Table'[dimension] ),
RANKX ( CALCULATETABLE (VALUES ( 'Table'[dimension]),ALLSELECTED ('Table'[dimension])),[Measure]))

 

Als bessere Erläuterung hier ein Beispiel:

 

DimensionMeasure: PriceRank

Apfel

10€3
Orange25€2
Kirschen50€1
Birne5€4

 

Rank dimension= IF (ISINSCOPE( 'Table'[dimension] ),
RANKX ( CALCULATETABLE (VALUES ( 'Table'[dimension]),ALLSELECTED ('Table'[dimension])),[Measure: Price]))
 

Hier habe ich die Rankx Formel auf Price festgelegt und wenn ich jetzt die Menge Anzeigen würde müsste ich ja eine neue Measure berechnung erstellen

 

DimensionMeasure: MengeRank

Apfel

1001
Orange362
Kirschen173
Birne84

 

Rank dimension= IF (ISINSCOPE( 'Table'[dimension] ),
RANKX ( CALCULATETABLE (VALUES ( 'Table'[dimension]),ALLSELECTED ('Table'[dimension])),[Measure: Menge]))
 
Wäre es möglich das ganze irgendwie so zubauen:
 
Rank dimension= IF (ISINSCOPE( 'Table'[dimension] ),
RANKX ( CALCULATETABLE (VALUES ( 'Table'[dimension]),ALLSELECTED ('Table'[dimension])),[Currently Selected Measure?]))
 
Danke für eure Hilfe! 🙂 

 

1 ACCEPTED SOLUTION
AlB
Community Champion
Community Champion

Hi @Anonymous 

You can create the measure [Currently Selected Measure?] such that it reads from a slicer the name of the measure to be applied and invokes one of the measures you already have (Preice, Menge, etc.) Create a one-column table with the names of the measures and set it as a slicer

SlicerTable[Metric]

  Measure Preis

  Measure Menge

  Measure 3

  Measure 4

 

The user can then select the measure to apply by picking its name in the slicer. The main measure code is then something like: 

Currently Selected Measure? = 
SWITCH (
    SELECTEDVALUE ( SlicerTable[Metric] ),
    "Measure Preis", [Measure Preis],
    "Measure Menge", [Measure Menge],
    "Measure 3", [Measure 3],
    "Measure 4", [Measure 4] //etc Include more measures after this if required
)

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hey @AIB,

 

it worked with your Solution. I put the SlicerTable as a Filter and selected there the KPI i wanted to show. Could also do conditinal formating. Thanks a lot❤ 🙂  

 

 

Dyn Rank = IF (ISINSCOPE( 'Filter'[Dim] ), 
RANKX ( CALCULATETABLE (VALUES ( 'Filter'[Dim]),ALLSELECTED ('Filter'[Dim])),[Currently Selected Measure?])
)
 
Currently Selected Measure? =
SWITCH (
SELECTEDVALUE ( SlicerTable[KPIs] ),
"Kur", FORMAT([KUR],"Percent"),
"Erstbesteller Anteil", FORMAT([Erstbesteller Anteil],"Percent"),
"eCPC", FORMAT([eCPC],"Currency"),
"eCPM", FORMAT([eCPM],"Currency"),
"Rendite", FORMAT([Rendite],"Currency") //etc Include more measures after this if required
)
 
Do you know if there is a form to read out witch Measure you have put into the Value field of a visualization?
 
 

 

AlB
Community Champion
Community Champion

@Anonymous 

You mean you want to read that in your code? If so, not that I know. What are you trying to do? Perhaps there's a different approach we can use

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

AlB
Community Champion
Community Champion

@Anonymous 

Perhaps a workaround can be found  with calculation groups.

However, the name of the measure used inthe chart will already show in the title of the chart

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

AlB
Community Champion
Community Champion

Hi @Anonymous 

You can create the measure [Currently Selected Measure?] such that it reads from a slicer the name of the measure to be applied and invokes one of the measures you already have (Preice, Menge, etc.) Create a one-column table with the names of the measures and set it as a slicer

SlicerTable[Metric]

  Measure Preis

  Measure Menge

  Measure 3

  Measure 4

 

The user can then select the measure to apply by picking its name in the slicer. The main measure code is then something like: 

Currently Selected Measure? = 
SWITCH (
    SELECTEDVALUE ( SlicerTable[Metric] ),
    "Measure Preis", [Measure Preis],
    "Measure Menge", [Measure Menge],
    "Measure 3", [Measure 3],
    "Measure 4", [Measure 4] //etc Include more measures after this if required
)

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.