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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Noredlac86
Helper I
Helper I

Power BI Add rank or row number to column in a table chart

Hi Team.
I was wondering if you can help me with this issue. I have a table with car sellers.

CAR           Sell by
MAzda        Juan
Ford            Juan
Mazda2        Jhon

Therefore i create a table visualizations that show the top 5 sellers, its just a visual  and i count the column "SellBy"

Noredlac86_1-1676386837357.png

 

Noredlac86_2-1676386860890.png

 

But i want to add a new Column, with the order (Color Red), do you know how can i create this new column to show in the report.

Thanks

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @Noredlac86 ,

I created some data:

vyangliumsft_0-1676509620620.png

 

Here are the steps you can follow:

1. Modeling – New parameter -- Fields.

vyangliumsft_1-1676509620622.png

vyangliumsft_2-1676509620625.png

2. Create measure.

Count_Car =
COUNTX(
    FILTER(ALL('Table'),'Table'[Car]=MAX('Table'[Car])),[Sellby])
Count_Sellby =
COUNTX(
    FILTER(ALL('Table'),'Table'[Sellby]=MAX('Table'[Sellby])),[Sellby])
rank_car =
RANKX(
    ALLSELECTED('Table'),[Count_Car],,ASC,Dense)
rank_sellby =
RANKX(
    ALLSELECTED('Table'),[Count_Sellby],,ASC,Dense)
Top =
SWITCH(
    TRUE(),
    MAX('Parameter'[Parameter])="Car",[rank_car],
    MAX('Parameter'[Parameter])="Sellby",[rank_sellby])

3. Result:

When selecting Car, sort by car

vyangliumsft_3-1676509620627.png

When choosing Sellby, sort by Sellby

vyangliumsft_4-1676509620630.png

 

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

3 REPLIES 3
v-yangliu-msft
Community Support
Community Support

Hi  @Noredlac86 ,

I created some data:

vyangliumsft_0-1676509620620.png

 

Here are the steps you can follow:

1. Modeling – New parameter -- Fields.

vyangliumsft_1-1676509620622.png

vyangliumsft_2-1676509620625.png

2. Create measure.

Count_Car =
COUNTX(
    FILTER(ALL('Table'),'Table'[Car]=MAX('Table'[Car])),[Sellby])
Count_Sellby =
COUNTX(
    FILTER(ALL('Table'),'Table'[Sellby]=MAX('Table'[Sellby])),[Sellby])
rank_car =
RANKX(
    ALLSELECTED('Table'),[Count_Car],,ASC,Dense)
rank_sellby =
RANKX(
    ALLSELECTED('Table'),[Count_Sellby],,ASC,Dense)
Top =
SWITCH(
    TRUE(),
    MAX('Parameter'[Parameter])="Car",[rank_car],
    MAX('Parameter'[Parameter])="Sellby",[rank_sellby])

3. Result:

When selecting Car, sort by car

vyangliumsft_3-1676509620627.png

When choosing Sellby, sort by Sellby

vyangliumsft_4-1676509620630.png

 

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Noredlac86
Helper I
Helper I

Hi @v-yangliu-msft 
Thanks for your time to read my message and reply. The only problem that i have, is that i have the original tablein that way:

Noredlac86_0-1676476131436.png

 


I just have this, so if i want to know the top 5 sellers, i just add a visual table and i make a count for the column "Sellby" if i want to know the top 5 cars more sells, i make the same, new visual table and count for the car column.

I have tried using this formula, but its not working, cause in the original table i dont have another coumn, and i cant add more columns

 

v-yangliu-msft
Community Support
Community Support

Hi  @Noredlac86 ,

I created some data:

vyangliumsft_0-1676439727575.png

 

 

Here are the steps you can follow:

1. Create measure.

Sell_measure =
SUMX(
    FILTER(ALL('Table'),'Table'[Sell by]=MAX('Table'[Sell by])),[Sell])
TOP =
RANKX(
    ALLSELECTED('Table'),[Sell_measure],,DESC,Dense)
Flag =
IF(
    [TOP]<=5,1,0)

3. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_1-1676439727575.png

4. Result:

vyangliumsft_2-1676439727578.png

 

Best Regards,

Liu Yang

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.