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
Anonymous
Not applicable

Dynamically Rank Items Based on Sales per Month

Hello All,

 

I'm Trying To generate the Rank Column in the following Table

 

MonthColumn1CustomerSalesMonthly Customer SalesRank
1-JanJanCustomer1         20,714         73,9082
2-JanJanCustomer1         27,793         73,9082
3-JanJanCustomer1         25,401         73,9082
4-JanJanCustomer2         25,445         78,9711
5-JanJanCustomer2         26,388         78,9711
6-JanJanCustomer2         27,138         78,9711
7-JanJanCustomer3         14,017         73,4353
8-JanJanCustomer3         29,776         73,4353
9-JanJanCustomer3         29,642         73,4353
1-FebFebCustomer1         21,175         55,0233
2-FebFebCustomer1         10,873         55,0233
3-FebFebCustomer1         22,975         55,0233
4-FebFebCustomer2         26,087         57,0762
5-FebFebCustomer2         20,605         57,0762
6-FebFebCustomer2         10,384         57,0762
7-FebFebCustomer3         29,730         71,8561
8-FebFebCustomer3         12,634         71,8561
9-FebFebCustomer3         29,492         71,8561
1-MarMarCustomer1         24,603         62,7132
2-MarMarCustomer1         10,636         62,7132
3-MarMarCustomer1         27,474         62,7132
4-MarMarCustomer2         24,958         61,0913
5-MarMarCustomer2         15,683         61,0913
6-MarMarCustomer2         20,450         61,0913
7-MarMarCustomer3         18,982         72,6611
8-MarMarCustomer3         24,464         72,6611
9-MarMarCustomer3         29,215         72,6611

 

Rank here would be described as Rank of the Customer Total Sales per Given Month on a given month

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Picture1.png

 

New Table =
SUMMARIZECOLUMNS (
Dates[Month Name],
Customers[Customer],
"@monthly sales", SUM ( Sales[Sales] ),
"@monthly sales rank",
VAR _currentmonth =
MAX ( Dates[Month Name] )
VAR _ranktable =
SUMMARIZE (
CALCULATETABLE (
ALL ( Sales ),
Dates[Month Name] = _currentmonth
),
Customers[Customer]
)
VAR _ranking =
RANKX (
_ranktable,
CALCULATE (
SUM ( Sales[Sales] )
),
,
DESC
)
RETURN
_ranking
)
 
 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

1 REPLY 1
Jihwan_Kim
Super User
Super User

Picture1.png

 

New Table =
SUMMARIZECOLUMNS (
Dates[Month Name],
Customers[Customer],
"@monthly sales", SUM ( Sales[Sales] ),
"@monthly sales rank",
VAR _currentmonth =
MAX ( Dates[Month Name] )
VAR _ranktable =
SUMMARIZE (
CALCULATETABLE (
ALL ( Sales ),
Dates[Month Name] = _currentmonth
),
Customers[Customer]
)
VAR _ranking =
RANKX (
_ranktable,
CALCULATE (
SUM ( Sales[Sales] )
),
,
DESC
)
RETURN
_ranking
)
 
 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


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.