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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
MichaelaMul
Helper III
Helper III

Rank Function

Hi everyone,

 

I am trying to use the Rank function to then use as a filter on a multi-card to show Our Brands + the Top 3 by Volume Sales. How can I order it by Volume Sales and not the Size Name? When I remove the 'WeeklyData'[Size Name], ASC, the ranking changes to just 1. Also is there a way to remove any Size Name that has OurBrand = 1, so that 2 doesn't disappear from the ranking as seen in the screenshot?

 

Weekly Rank = 
        VAR SourceTable =
           ADDCOLUMNS ( ALLSELECTED ( 'WeeklyData'[Geography],'WeeklyData'[Concat (groups)],'WeeklyData'[Product], 'WeeklyData'[Size Name], 'WeeklyData'[Concat (groups)] ), "@Amt", SUM('WeeklyData'[Volume Sales]) )
        VAR Result =
            RANK ( DENSE, SourceTable, ORDERBY ( [@Amt], DESC, 'WeeklyData'[Size Name], ASC ) )

    RETURN
    if(sum('WeeklyData'[OurBrand])=1,0, Result)

 

MichaelaMul_0-1753286208192.png

 

4 REPLIES 4
Shahid12523
Resident Rockstar
Resident Rockstar

- Use FILTER to exclude OurBrand = 1 from the ranking logic.
- Rank by Volume Sales only, using RANKX with DESC.
- Return BLANK() for OurBrand rows so they don’t affect the rank.
- Then filter visuals with: Weekly Rank <= 3 || OurBrand = 1 to show Top 3 + OurBrand.
Let me know if you want a dynamic Top N version or a disconnected slicer setup.

Shahed Shaikh
speedramps
Super User
Super User

Thanks for the input data.

I want to help you but your description is too vague and jumbled.
Considering deleting this post and starting from scratch.  

 

You will get a quicker and better response without misunderstandings if you put time and effort into carefully writing a clear problem description with example input and output data. Look forward to helping you when this information is forthcoming


* Please DO give a simple non-technical functional description of what you want
* Keep it simple and break large projects into smaller questions and ask just one question per ticket.
* Provide the example desired output, with a clear step-by-step description of calculations and the process flow.
* Remove any unneeded tables, rows or columns which may cause confusion. Keep it short and concise with the minimal information regarding the key problem.
* Avoid describing the problem in multiple, fragmented and conflicting posts. Try describe the problem with input data, output example and the step-by-step process in one post. 

MichaelaMul
Helper III
Helper III

My goal is to make a measure that ranks the Size Name by Volume Sales, filterable by Geography, Time, Concat Group. My goal is to use this measure in a multi-card visual to show Our Brand Size Names + the other Top 3 Size Names by Volume Sales.

 

Sample Data: 

GeographyTimeSize NameVolume SalesPrice per UnitConcat (groups)OurBrandDateTotalSizeSalesLatest Week
Store AWeek Ending 07-13-25Our Product A 64oz518293.8166627756661*$Juice107-13-251709873.59FALSE
Store AWeek Ending 07-20-25Our Product A 64oz56903.53.62501Juice107-20-251709873.59TRUE
Store AWeek Ending 07-20-25Our Product A 96oz53373.754.851506Juice107-20-251460217.419TRUE
Store AWeek Ending 07-13-25Our Product A 96oz57115.54.773362Juice107-13-251460217.419FALSE
Store AWeek Ending 07-20-25PL A 64 OZ 493222.819019Juice007-20-251333216.293TRUE
Store AWeek Ending 07-13-25PL A 64 OZ 510592.797007Juice007-13-251333216.293FALSE
Store AWeek Ending 07-13-25S A 64 OZ29980.53.545167Juice007-13-25888080.5089FALSE
Store AWeek Ending 07-20-25S A 64 OZ27995.53.620584Juice007-20-25888080.5089TRUE
Store AWeek Ending 07-20-25PL A 96 OZ 127953.743372Juice007-20-25350656.3278TRUE
Store AWeek Ending 07-13-25PL A 96 OZ 12662.253.653616Juice007-13-25350656.3278FALSE
Store AWeek Ending 07-20-25C F AL 48 OZ12171.384.343198Juice007-20-25294282.0495TRUE
Store AWeek Ending 07-13-25C F AL 48 OZ11218.134.613484Juice007-13-25294282.0495FALSE
Store AWeek Ending 07-20-25S A 96 OZ3808.55.538405Juice007-20-25182436.7589TRUE
Store AWeek Ending 07-13-25S A 96 OZ3931.55.494836Juice007-13-25182436.7589FALSE
Store AWeek Ending 07-13-25S A 58 OZ2409.1245.104584Juice007-13-2575611.56717FALSE
Store AWeek Ending 07-20-25S A 58 OZ2280.5335.130653Juice007-20-2575611.56717TRUE
Store AWeek Ending 07-13-25R A 2 OZ2263.2063.970062Juice007-13-2548963.15768FALSE
Store AWeek Ending 07-20-25R A 2 OZ2188.6354.089286Juice007-20-2548963.15768TRUE
Store AWeek Ending 07-20-25M A 28 OZ1601.1786.694758Juice007-20-2544675.76272TRUE
Store AWeek Ending 07-13-25M A 28 OZ1729.8336.569135Juice007-13-2544675.76272FALSE
Store AWeek Ending 07-20-25C F AL 72 OZ802.68755.960498Juice007-20-2521032.08821TRUE
Store AWeek Ending 07-13-25C F AL 72 OZ799.8755.962011Juice007-13-2521032.08821FALSE
Store BWeek Ending 07-13-25Our Product A 64oz62194.83.8166627756661*$Juice107-13-251709873.59FALSE
Store BWeek Ending 07-20-25Our Product A 64oz48367.983.62501Juice107-20-251709873.59TRUE
Store BWeek Ending 07-20-25Our Product A 96oz53373.754.851506Juice107-20-251460217.419TRUE
Store BWeek Ending 07-13-25Our Product A 96oz68538.64.773362Juice107-13-251460217.419FALSE
Store BWeek Ending 07-20-25PL A 64 OZ 69050.82.819019Juice007-20-251333216.293TRUE
Store BWeek Ending 07-13-25PL A 64 OZ 54122.542.797007Juice007-13-251333216.293FALSE
Store BWeek Ending 07-13-25S A 64 OZ28781.283.545167Juice007-13-25888080.5089FALSE
Store BWeek Ending 07-20-25S A 64 OZ23796.183.620584Juice007-20-25888080.5089TRUE
Store BWeek Ending 07-20-25PL A 96 OZ 16633.53.743372Juice007-20-25350656.3278TRUE
Store BWeek Ending 07-13-25PL A 96 OZ 20259.63.653616Juice007-13-25350656.3278FALSE
Store BWeek Ending 07-20-25C F AL 48 OZ13023.374.343198Juice007-20-25294282.0495TRUE
Store BWeek Ending 07-13-25C F AL 48 OZ10545.044.613484Juice007-13-25294282.0495FALSE
Store BWeek Ending 07-20-25S A 96 OZ2818.295.538405Juice007-20-25182436.7589TRUE
Store BWeek Ending 07-13-25S A 96 OZ3774.245.494836Juice007-13-25182436.7589FALSE
Store BWeek Ending 07-13-25S A 58 OZ2120.0295.104584Juice007-13-2575611.56717FALSE
Store BWeek Ending 07-20-25S A 58 OZ4333.0135.130653Juice007-20-2575611.56717TRUE
Store BWeek Ending 07-13-25R A 2 OZ1471.0843.970062Juice007-13-2548963.15768FALSE
Store BWeek Ending 07-20-25R A 2 OZ2407.4994.089286Juice007-20-2548963.15768TRUE
Store BWeek Ending 07-20-25M A 28 OZ2401.7686.694758Juice007-20-2544675.76272TRUE
Store BWeek Ending 07-13-25M A 28 OZ2110.3966.569135Juice007-13-2544675.76272FALSE
Store BWeek Ending 07-20-25C F AL 72 OZ794.66065.960498Juice007-20-2521032.08821TRUE
Store BWeek Ending 07-13-25C F AL 72 OZ1039.8385.962011Juice007-13-2521032.08821FALSE
Store CWeek Ending 07-13-25Our Product A 64oz74633.763.8166627756661*$Juice107-13-251709873.59FALSE
Store CWeek Ending 07-20-25Our Product A 64oz41112.783.62501Juice107-20-251709873.59TRUE
Store CWeek Ending 07-20-25Our Product A 96oz53373.754.851506Juice107-20-251460217.419TRUE
Store CWeek Ending 07-13-25Our Product A 96oz82246.324.773362Juice107-13-251460217.419FALSE
Store CWeek Ending 07-20-25PL A 64 OZ 96671.122.819019Juice007-20-251333216.293TRUE
Store CWeek Ending 07-13-25PL A 64 OZ 57369.892.797007Juice007-13-251333216.293FALSE
Store CWeek Ending 07-13-25S A 64 OZ27630.033.545167Juice007-13-25888080.5089FALSE
Store CWeek Ending 07-20-25S A 64 OZ20226.753.620584Juice007-20-25888080.5089TRUE
Store CWeek Ending 07-20-25PL A 96 OZ 21623.553.743372Juice007-20-25350656.3278TRUE
Store CWeek Ending 07-13-25PL A 96 OZ 32415.363.653616Juice007-13-25350656.3278FALSE
Store CWeek Ending 07-20-25C F AL 48 OZ13935.014.343198Juice007-20-25294282.0495TRUE
Store CWeek Ending 07-13-25C F AL 48 OZ9912.3354.613484Juice007-13-25294282.0495FALSE
Store CWeek Ending 07-20-25S A 96 OZ2085.5355.538405Juice007-20-25182436.7589TRUE
Store CWeek Ending 07-13-25S A 96 OZ3623.275.494836Juice007-13-25182436.7589FALSE
Store CWeek Ending 07-13-25S A 58 OZ1865.6265.104584Juice007-13-2575611.56717FALSE
Store CWeek Ending 07-20-25S A 58 OZ8232.7255.130653Juice007-20-2575611.56717TRUE
Store CWeek Ending 07-13-25R A 2 OZ956.20473.970062Juice007-13-2548963.15768FALSE
Store CWeek Ending 07-20-25R A 2 OZ2648.2494.089286Juice007-20-2548963.15768TRUE
Store CWeek Ending 07-20-25M A 28 OZ3602.6516.694758Juice007-20-2544675.76272TRUE
Store CWeek Ending 07-13-25M A 28 OZ2574.6836.569135Juice007-13-2544675.76272FALSE
Store CWeek Ending 07-20-25C F AL 72 OZ786.7145.960498Juice007-20-2521032.08821TRUE
Store CWeek Ending 07-13-25C F AL 72 OZ1351.7895.962011Juice007-13-2521032.08821FALSE
speedramps
Super User
Super User

I want to help you but your description is too vague and jumbled. Please write it again.

 

For example you mention "Our brands" but there is no brand data in your example. 


You will get a quicker and better response without misunderstandings if you put time and effort into carefully writing a clear problem description with example input and output data. Look forward to helping you when this information is forthcoming


* Please DON'T copy & paste your DAX that does not work and expect us to fathom what you want. (That is just crazy). ‌‌
* Please DO give a simple non-technical functional description of what you want
* Keep it simple and break large projects into smaller questions and ask just one question per ticket.
* Rename columns to user friendly names. Avoid your own system jargon that we may not understand.
* Most importantly please provide example input data as table text (not a screen print) so helpers can import the data to build a solution for you. (Learn how to share data below)
* Provide the example desired output, with a clear step-by-step description of calculations and the process flow.
* Take time and care to use the same table and field names in the input, output and description so we can understand your problem and help you.
* Remove any unneeded tables, rows or columns which may cause confusion. Keep it short and concise with the minimal information regarding the key problem.
* Remember not to share private data ... we don't want you to get into trouble. ‌‌ Go to effort of creating fictional data.
* Please click the thumbs up button for these helpful hints and tips. Thank you.


Learn how to attach data in the forum using OneDrive:-
* Save your file in a OneDrive folder
* Right click on the file and click the “Share” blue cloud icon
* Click the bottom “Copy” button
* Click” Anyone with link can edit”
* Click “Can Edit”
* Click “Can View”
* Click “Apply” button
* Click “Copy”
* Paste the generated link via the forum, email, chat, or any other method.
* Helpers can then download your data, build a solution and share it back.


Learn how to attach data in the forum using Dropbox:-
1. Open Dropbox: Access the Dropbox folder on your computer or through the Dropbox web interface.
2. Select File/Folder: Find the file or folder you want to share.
3. Click Share (or Get Link): Look for a "Share" option or a similar "Get Link" option.
4. Choose Permissions: Decide whether to allow "view only" or "view and download" access.
5. Copy and Share: Copy the generated link and share it with anyone via the forum, email, chat, or any other method.

 

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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