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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Luis_Gomez
Frequent Visitor

Showing rank results as columns

Hi,

 

I am developing a report, here are the specifics:

Rank top 5 brands by territory based on a formula, the report must look like this:

 

Luis_Gomez_0-1675873013649.png

The ranking must be in columns "Marca_1" and "_Rank_Presencia_1" for Top 1 and so on up to Top 5.

I am using the following formula to calculate "Marca_1" which gives me the name of the brand on the Top 1, the formula repeats up to 5

 

 

 

 

 

_Rank_Presencia_Marca_1 = 
var test = IF( HASONEVALUE('Ventas'[Marca]) && [_%_Presencia_por_Marca]>0,
Var Result = RANKX(ALL(Ventas[Marca]),[_%_Presencia_por_Marca])

Return
Result)
Return
IF(test=1, MAX(Ventas[Marca]),BLANK())

 

 

 

 

 

And the formula for the value is:

 

 

 

_Rank_Presencia_1 = 
var test = IF( HASONEVALUE('Ventas'[Marca]) && [_%_Presencia_por_Marca]>0,
    Var Result = RANKX(ALL(Ventas[Marca]),[_%_Presencia_por_Marca])

    Return
    Result)
Return
IF(test=1, [_%_Presencia_por_Marca],BLANK())

 

 

 

Same here, a formula for Top 1 up to Top 5

 

Now, displaying the results on a Table visual, the most I can get is up to here:

 

Luis_Gomez_1-1675873642600.png

There is a visual filter that limits te report to the Top 5,

 

Luis_Gomez_2-1675873868703.png

 

I have to put Brand as a column in order to calculate correctly, all calculations are correct but I cannot find a way to format the report as has been requested. 

 

Any suggestions will be kindly appreciated.

 

Regards

 

Luis Gómez

 

1 REPLY 1
v-yiruan-msft
Community Support
Community Support

Hi @Luis_Gomez ,

How did you set your visual? In order to get a better understanding on your problem and give you a suitable solution, could you please provide some raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.