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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
DagmaraBI
Regular Visitor

RANKX working OBLY within a table

Hi Guys!

 

I have a small issue, but a real pain 🙂 

 

I have two tables:
FactSales - data about units sold

DimStore - stores in which this units are sold


I want to get THE BEST PERFORMING store, in which case I want to rank my stores based on Units sold.

 

I have prepared measure:

RankX by Store =
RANKX(
    ALL(DimStore[Store_Name]),
    SUM([Units])
    )
 
But its gets me wrong values. 
Stores.JPG
 
My model is really simple. 
DimStore[Store_Id] - FactSales[Store_Id]
        1            -                 many
  model.JPG
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@DagmaraBI , if you create a rank on the store name and use storeId in visual, rank of store will get distributed inside store id 

 

Try like

Rank = RANKX(all(Dim_store),calculate(Sum(Table[Unit]) ) )

 

or

 

Rank = RANKX(all(Dim_store[Store_id],Dim_store[Store_name] ),calculate(Sum(Table[Unit]) ) )

 

explained here - https://www.youtube.com/watch?v=cN8AO3_vmlY&t=25627s

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@DagmaraBI , if you create a rank on the store name and use storeId in visual, rank of store will get distributed inside store id 

 

Try like

Rank = RANKX(all(Dim_store),calculate(Sum(Table[Unit]) ) )

 

or

 

Rank = RANKX(all(Dim_store[Store_id],Dim_store[Store_name] ),calculate(Sum(Table[Unit]) ) )

 

explained here - https://www.youtube.com/watch?v=cN8AO3_vmlY&t=25627s

Tahnk you 🙂
You helped me very much 🙂 

I will subsribe your channel for more knowledge 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.