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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
RuthMerchán
Helper I
Helper I

How to calculate a rank excluding dimension of days of the week?

Hi everyone!

 

I would like you to help me with this problem. I have slicers for plant, tipo_mov, year and week. 

the filter of week is based on a column created like this:

weekbydefault =
IF ("Sem" & WEEKNUM(TODAY()) & " - " & RIGHT(TODAY(),2)= DIM_TIEMPO[Mensualmente],
 "Actual",
 DIM_TIEMPO[Mensualmente])
 
RuthMerchn_0-1686788977818.png

 

and I have created two tables, the first table:

 

RuthMerchn_1-1686789028210.png

and I also want to create another table with one column more (the days of the week). I would like to get the same result in the rank as the first table for each product. I mean, i would like to calculate the rank excluding day_desc dimension, maintaining the same rank like this:

RuthMerchn_2-1686789117138.png

 

I have this formula and almost I got the same result of rank for each product in both tables, but something is wrong because it does not work at all...

 

RANKX(

CALCULATETABLE( VALUES('DIM_MARCA'[Product]),

ALLSELECTED('DIM_MARCA') ),

 

CALCULATE( SUM(fact_movimientos_turnos[Amount]),

ALLEXCEPT( f

act_movimientos_turnos,

'FACT_MOVIMIENTOS_TURNOS'[TIPO_MOV],

'DIM_MARCA'[Marca], 'DIM_ARTICULO'[Planta],

'DIM_TIEMPO'[year],

'DIM_TIEMPO'[week] ),

 

ALL('DIM_TIEMPO'[Day_DESC]) ) )

 

the result is the following:

RuthMerchn_3-1686789621420.png

 

Something I am doing wrong because Product C, according table1, shoul have rank 3, not 4. I hope I have explained myself well. 

Please, could you help me.

Thank you so much!

Ruth

 

 

 

 

 
 
2 REPLIES 2
amitchandak
Super User
Super User

@RuthMerchán , On the best way to deal with such think to have separate date and product table.

 

This should work

RANKX(

allselected VALUES('DIM_MARCA'[Product]),

CALCULATE( SUM(fact_movimientos_turnos[Amount])),,desc,dense)

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

it says syntax error: The syntax of 'VALUES' is not correct (DAX(RANKX(allselected VALUES('DIM_MARCA'[Product]),CALCULATE( SUM(fact_movimientos_turnos[Amount])),,desc,dense).

 

 

I am interesting in having days of the week too, because I want to make a line graph with x axis (days of the week), y axis (amount) and legend (products). As I am working with a parameter thar shows this graph according products or categories, This formula is the base of what I would like to do. The goal is to put this rank_measure in filters and select to show equal or lower than 10 rank. This is the way I think I can get a top N whith a parameter of this type, as I can not put two fields for make TOPN in the same visualization (in this case topn for product and topn for category).

 

First, this formula has to work so that I can use it in another formula taking into account the parameter, and it does not work as I expected. 


The rank for each product or category shoud be the same as table 1 (example) and it is being different...

Maybe, getting this functionality is not possible...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.