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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.