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
seanwu
Regular Visitor

Ranking the Order Date

Hi,

 

I am still learning DAX. But I am running into a problem.

 

I have a "Sales" table that lists all the sales by "CustomerKey", "OrderDate" and "OrderAmount" and a bunch of other columns that are not the focus of my concern for this purpose.  In this "Sales" Table, one "CustomerKey" can have mulitiple "OrderDate"s. One "CustomerKey" can have mulitple orders on the same day too. 

 

I want to create a table (named "CleanTable") by using SUMMARIZECOLUMNS as follows:

CleanTable=SUMMARIZECOLUMNS(Sales[CustomerKey],Sales[OrderDate])

The purpose of this "CleanTable" is to get rid of those "other columns" that are not the focus of my concern and also Summarize the "Sales" table by CustomerKey and OrderDate.

 

CleanTable is created with no glitch. Now I want to add a column (Let's call it "OrderDateRank")to the CleanTable to rank the OrderDate column WITHIN each CustomerKey.  For example, if CustomerKey 1 in the CleanTable has three OrderDate (7/15/2018, 7/16/2018, 7/17/2018), then this "OrderDateRank" will have value 1 to 7/15/2018, 2 to 7/16/2018 and 3 to 7/17/2018).

 

How can I do that? The key is that it has to be within each CustomerKey, NOT All across all the OrderDate.

 

Thanks a lot.

2 REPLIES 2
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @seanwu ,

I have still a little confused about your scenario.

If it is convenient, could you share the data sample with table format and your desired output so that we could help further on it?

Please refer to this blog about how to get your question answered quickly.

Best Regards,

Cherry

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi v-piga-msft,

 

Thanks for looking into this.

 

I saved a file on DropBox.

 

As you can see, there is a sales table with Customer Name, Year, Country and Sales Amount. 

 

I want a couple of Rankings in calculated columns of this sales table.

 

The first one I created myself: RankAcrossAll, as its name indicates, it ranks all customers across all years and countries based on their sales amount. 

 

I run into difficulty in creating the following two rankings:

 

1. Rank customers, Within each country, but across years, by sales amount.

2. Rank customers, Within BOTH each country and Year by sales amount

 

Thank you again for your time and attention.

 

SeanWu

 

 

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.