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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
m_wex
Helper I
Helper I

RANKX issue with previous sales

Having an issue with dynamic ranking and need some advice and guidance.  Multiple attemps have been made to fix this issue but my beginner level skill has kept the solution out of reach. 

 

Have a report showing total sales by part number. The user can select a ranking from a slicer and the corresponding table will shows only those items for the rank selected. 

 

The problem begins when you want to see "all" sales. The ranking works but the outcome is not expected as it is excluding previous years sales which were not sold in the current year. A simple check on an unfiltered table (Rank, Material Number, Current sales, Previous Sales) confirmed that items without sales in the current year have a blank for ranking. Only items with current sales receive a rank, like below.

 

RankMaterialCY SalesPY Sales
 ABC $100.00
 DEF $200.00
1GHI$500.00$300.00

 

This is not unusual as current sales are being ranked but when "All" ranking is selected the expected outcome is to see all current and previous year sales. The part ranking table created does not account for blank rankings. In the above example, the sales total for the previous period would be short $300.00. The expected outcome for All Sales would be CY Sales=$500 and PY Sales=$600.

 

The table being used consists of only maximum values (5,10, 25, 50, 10000). Is there a way to account for blanks? Shown below is the DAX formulas along with a link to a sample file. 

 

Any help would be greatly appreciated - M_Wex

 

m_wex_1-1630790803841.png

Material-Description Sales Ranking =
VAR
RankingDimesion=Values(Sales[Material])
Var
RankingSelect = [Ranking Select PN]
Return
CALCULATE([Total Sales],
Filter( RankingDimesion,
RankX(all(Sales[Material], Sales[Description]) ,[Total Sales], ,desc )<= RankingSelect))

 

Ranking Select PN =
if(HASONEVALUE('Top Part Selection'[Part Rank]) , Values('Top Part Selection'[Park Rank Index] ), blank())
 
Top Part Selection
m_wex_2-1630791119163.png

 

https://1drv.ms/u/s!AnQQfxYxFNvukQijVc8dsTSxBEwo?e=t2NHAo

0 REPLIES 0

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors