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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
SLI
Helper IV
Helper IV

Product's Rank

hi 

 

i have 3 dimension's tables (dim_time, dim_product and dim_pointofsale) and 1 fact table (fact_production) in wich i have sales by product, date and point of sale

i have calculated THSalesp M-1 = calculate (sum (fact_production [sales]), previousmonth (dim_time [date]))

 

i would like to have the position (rank)of my product compared to Sales previous month per date and point of sale

 

is it possible with dax

i have used this formula but the result is not correct

Rank =
RANKX (
ALL( FACT_Production[ReferenceProduit]),calculate([THSalesp M-1],ALLEXCEPT(FACT_Production,FACT_Production[ReferenceProduit],FACT_Production[POS],FACT_Production[Date])),,DESC,Dense)

 

Here i share with you my sample of model

 

thank you in advance for your help

SLI

 

 

1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

@SLI 

 

Isn't this the same question we discussed here?

https://community.powerbi.com/t5/Desktop/How-to-find-out-if-a-product-is-in-the-top-20-of-last-month... 

 

or do you need further help?

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

5 REPLIES 5
PaulDBrown
Community Champion
Community Champion

@SLI 

 

Isn't this the same question we discussed here?

https://community.powerbi.com/t5/Desktop/How-to-find-out-if-a-product-is-in-the-top-20-of-last-month... 

 

or do you need further help?

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Hi
It is the same ☺️ And your solution works very good
Thank you so much
Regards
v-jayw-msft
Community Support
Community Support

Hi @SLI ,

 

Try split your measure as below and see if the result is what you want.

Measure 1 = CALCULATE(SUM(FACT_Production[THSales]),ALLEXCEPT(FACT_Production,FACT_Production[ReferenceProduit],FACT_Production[POS],FACT_Production[Date]))

Measure 2 = RANKX(ALL(FACT_Production),[Measure 1],,DESC,Dense)

 

Best Regards,

Jay

Community Support Team _ Jay Wang

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

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
amitchandak
Super User
Super User

Create measure like these and use rank on top of that. Use calendar

MTD = CALCULATE(SUM(Table[Quantity]),DATESMTD('Date'[Date]))
LMTD = CALCULATE(SUM(Table[Quantity]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))

 

//Rank
Rank Last = RANKX(ALL(Sheet1[Seller Name]),[MTD],,DESC,Dense)
Rank Last = RANKX(ALL(Sheet1[Seller Name]),[LMTD],,DESC,Dense)

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.