Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi,
I am trying to achive o/p like below with given dataset in PowerBi and Dax.
Can you please help.
Req : I need to get top 2 values dynamically in each level of hierarchy.
Input data and Required output
Thanks,
Satya
Could you post that source data as text? Looks like you want a dynamic RANKX measure and those are always a treat so need sample data to work with. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
Thank you for helping @Greg_Deckler . Below is sample data. Please let me know if need more details.
Area Segment Product Value
A1 S1 P1 200
A1 S1 P2 100
A1 S1 P3 50
A1 S2 P2 400
A1 S2 P4 240
A1 S2 P5 310
A1 S2 P6 160
A1 S3 P3 300
A1 S3 P4 250
A2 S1 P8 150
A2 S1 P1 250
A2 S1 P6 600
A2 S2 P1 700
A2 S2 P2 100
A2 S2 P3 400
A2 S3 P4 350
A3 S1 P1 100
A measure
MeRank = RANKX(
FILTER(ALL( TableY), TableY[Segment] = MAX(TableY[Segment]) && TableY[Area] = MAX(TableY[Area])),
CALCULATE(SUM(TableY[Value])))
If you put Area, Segment, Product as Rows. Value in Values.
Add the MeRank to the Visual Filter and make it 'less than' 3
@HotChillithanks for the reply. tried as you suggested but i am getting the same value (as 1) for all levels.
Tried with below measure but i am getting top 2 values for entire segment level. But i need top2 values for each area as highlighted below. please help
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
10 | |
10 | |
9 | |
9 |
User | Count |
---|---|
20 | |
13 | |
12 | |
11 | |
8 |