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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
worthywow1988
Frequent Visitor

Lookup rank value?

Hi!

 

I have data where for a selected area I want to show the relative position compared to all the other areas. I've created a simple example:

 

AreaProductGroupSales
North1ABCA100
North2ABCA0
North3ABCA203
North4ABCA13
North5ABCA403
North6ABCA76
North7ABCA50
North8ABCA2
North1DEFA38
North2DEFA0
North3DEFA130
North4DEFA32
North5DEFA0
North6DEFA20
North7DEFA10
North8DEFA40
North1GHIB33
North2GHIB2
North3GHIB44
North4GHIB2
North5GHIB403
North6GHIB76
North7GHIB5
North8GHIB2
North1JKLB38
North2JKLB453
North3JKLB6
North4JKLB32
North5JKLB55
North6JKLB20
North7JKLB34
North8JKLB40

 

worthywow1988_0-1738693373081.png

 

I've created a rank table

 

RANKING_TABLE = filter(SUMMARIZE (TABLE_DATA,[Area],[Product],"Sales Adjusted",[Sales Adjusted] ),TABLE_DATA[Sales Adjusted]>0)

 

In the TABLE_DATA_SUMMARY in this example I would like to show the quartile labels North1 for ABC and DEF as calculated in the RANKING_TABLE

 

I've just pulled "Upper Quartile" into the summary to show what I'm after - appreciate this wouldn't/doesn't work!

 

I've tried LOOKUPVALUE but didn't seem to work - should I be using this or another approach?

 

The pbix file is here Ranking Example.pbix 

 

Any advice really appreciated!

1 ACCEPTED SOLUTION

Hi Rohit - many thanks for your reply - much appreciated!

 

In the end I got rid of the ranking tables since think was getting a bit messy. For neatness, simplicity and speed I just used min and max in the main table and then created a measure to see where the specific score sat in this range (lower, middle, top third). It's not actually ranking in the strict sense but is an ok measure in this situation since the scores are bounded and generally well distributed. Thanks again!

View solution in original post

11 REPLIES 11
rohit1991
Super User
Super User

hi @worthywow1988 ,

Your goal is to display the Upper Quartile Label from the RANKING_TABLE in the TABLE_DATA_SUMMARY. Since LOOKUPVALUE is not working as expected, try using CALCULATE with FILTER instead.

1. Create a Measure for Lookup:  Use CALCULATE to find the quartile label based on Area and Product:

Upper_Quartile_Label_Summary =
VAR SelectedArea = SELECTEDVALUE(TABLE_DATA[Area])
VAR SelectedProduct = SELECTEDVALUE(TABLE_DATA[Product])

RETURN
CALCULATE(
    MAX(RANKING_TABLE[Upper Quartile Label]),
    RANKING_TABLE[Area] = SelectedArea,
    RANKING_TABLE[Product] = SelectedProduct
)

2. Add the Measure to TABLE_DATA_SUMMARY

  • Place Upper_Quartile_Label_Summary in your TABLE_DATA_SUMMARY table.
  • This will fetch the corresponding quartile label for the selected Area and Product.
 
 

Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

Hi Rohit - many thanks for your reply - much appreciated!

 

In the end I got rid of the ranking tables since think was getting a bit messy. For neatness, simplicity and speed I just used min and max in the main table and then created a measure to see where the specific score sat in this range (lower, middle, top third). It's not actually ranking in the strict sense but is an ok measure in this situation since the scores are bounded and generally well distributed. Thanks again!

Anonymous
Not applicable

Hi,@worthywow1988 . It's great to see that you solved your problem and that you shared the method to the forum,
you can mark your option as a solution which will help other users in the forum.

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian

 

Anonymous
Not applicable

Hi,lbendlin ,thanks for your concern about this issue.

Your answer is excellent!
I tried to open your pbix but it failed due to environmental reasons, would you be able to share your pbix test file again by way of github/OneDirve (please don't encrypt it)


It looks like you tried to place the already created MEASURES into a calculation table that you created yourself and tried to filter them through the slicer.
As lbendlin mentioned, your requirement is feasible from an implementation point of view.
You could try using addcoulmns .

ADDCOLUMNS function (DAX) - DAX | Microsoft Learn
 

It is important to note:
Measure requires a specific calculation context in DAX (Data Analysis Expressions) to be calculated correctly. If the necessary context is missing from the calculation table, the measure may not return the expected result.
I recommend that you place the creation of the measure in the calculation table when you create it (as a variable spliced into this calculation table)

but it is important to note that the calculation table is static, while the individual measure is dynamic (the calculation table is not affected by the slicer, while the individual measure is affected by the slicer)
URL:

Table Filter does not work based on slicer selecti... - Microsoft Fabric Community

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Jian - thanks for your reply - much appreciated.

 

I've been trying different approaches and combinations all day but not getting closer 😓

 

I've created a new example and put it on OneDrive - hopefully you can download the pbix and source xls Example 2 

 

Screenshot 2025-02-07 173951.png

What I'm trying to achieve is to get a lower third percentile and upper third percentile for the measure "Positive %" grouped by level and question. I then want to use this to check where the score in the little table on the left above sits ("Low" if below the lower percentile, "High" if above the upper percentile and "Middle" if in between. In excel I have checked/calculated the values I want (in green) but always seem to get the overall values in pink

 

Screenshot 2025-02-07 174038.png

 

I have tried filtering, ALLEXCEPT etc. but nothing seems to work!

 

Any help/advice welcome!

 

 

 

You still use measures to formulate your RANKING_TABLE.  What's the intent? Are these values impacted by user interaction ?

 

Here's an alternative approach

RANKING_TABLE = ADDCOLUMNS(filter(TABLE_DATA,[Sales]>0),"Sales Adjusted",[Sales]*1.2)

Quartile Label = 
var p = [Product]
var LT= PERCENTILEX.INC(FILTER(RANKING_TABLE,[Product]=p),[Sales Adjusted], 0.33)
var MT= PERCENTILEX.INC(FILTER(RANKING_TABLE,[Product]=p),[Sales Adjusted], 0.66)
RETURN SWITCH(TRUE(),
[Sales Adjusted]<LT,"LOW",
[Sales Adjusted]<MT,"MED","HIGH")

Thanks - I'll try the alternative approach tomorrow!

 

As a bit more background what I've actually got is survey information consisting of summary scores at different regional levels so something like this

 

RegionQuestionResponseNumber of Responses
Continent AQ1Yes30
Continent AQ1No10
Continent AQ2Yes24
Continent AQ2No16
Country XQ1Yes10
Country XQ1No5
Country XQ2Yes8
Country XQ2No7
City QQ1Yes2
City QQ1No2
City QQ2Yes3
City QQ2No1

 

A continent has several countries and each country has several cities. I only have summary level information and there is an algorithm used by our provider which means I can't add up responses from lower levels i.e. the continent score is not exactly the sum of the country scores.

 

I've created a dashboard where the user can select a continent, country or city to view the detail. So for example the manager in charge of City Q selects this and all the results are shown. In this simplified example it's the Yes % (i.e. a measure). I also display the hierarchy so they can switch to their country or continent to see those results.

 

As part of the info I want to show where they sit relative to the other areas at the same regional level e.g. Out of the 30 cities, City Q is 15th so is in the "middle". So I'm trying to work out the percentiles for each question at the selected regional level and then compare to the selected city.

 

I've tried a few things but nothing's quite working - one issue I have is the question and regional areas are linked tables to the results table and don't seem to be able to use them in filters/ALLEXCEPTs etc.

 

Thanks again!

 

 

Thank you for the extra context, that helps.

 

Please provide sample data that fully covers your issue.
Please show the expected outcome based on the sample data you provided.

lbendlin
Super User
Super User

You are creating a calculated table based on a measure. While technically possible, it does not make sense as there is no filter context.  Please explain the 1.2 factor.

Hi! This was just a quick simple example so will be slightly out of context. The 1.2 factor was just a dummy factor since wanted to show the summary ranking table contains measures not just values.

 

To recap what I want to do is for a selected Area (e.g. North 1) and a selected Group (e.g. A) show where North 1 sits relative to the other areas. My actual dashboard is actually using third "quartiles" (tritiles?!). I've updated the example here Example v2 . So in the TABLE_DATA_SUMMARY I want the quartile to show as "HIGH" for ABC and "MID" for DEF from the ranking table

 

worthywow1988_1-1738768640949.png

 

 

 

 

lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.

Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Kudoed Authors