Ravindra Bagale · Power BIसर्व coursesया course चे lessonsशोधाEnglish

Power BI · मराठी आवृत्ती

13.17 RANKX आणि TOPN

रवींद्र बागले यांच्या course वर आधारित · सहज मराठीत explanation

RANKX(table, expression, value, order, ties) table मधल्या items ना expression नुसार rank देतो.

Product Rank =
IF(
    HASONEVALUE(Product[Product Name]),
    RANKX(ALL(Product[Product Name]), [Total Sales], , DESC, DENSE)
)

-- Rank dark stores by speed: fastest (lowest time) = rank 1
Store Speed Rank =
IF(
    HASONEVALUE(DarkStore[Store Name]),
    RANKX(ALL(DarkStore[Store Name]), [Avg Delivery Time (mins)], , ASC, DENSE)
)

Customer Rank in City =
RANKX(ALLSELECTED(Customer[Customer Name]), [Total Sales], , DESC)
Top 5 Products Sales =
CALCULATE(
    [Total Sales],
    TOPN(5, ALL(Product[Product Name]), [Total Sales], DESC)
)

Top 5 Share % = DIVIDE([Top 5 Products Sales], CALCULATE([Total Sales], ALL(Product)))

-- Calculated table of the 10 busiest dark stores
Top 10 Stores =
TOPN(
    10,
    ADDCOLUMNS(VALUES(DarkStore[Store Name]), "Orders", [Total Orders]),
    [Orders], DESC
)

Store speed rank मध्ये blank timesना fastest समजू नका; eligible stores filter करा. Product / Customer Name unique नसेल तर unique key वर ranking ठरवा.

TOPN

Top N rows ची table देतो. शेवटच्या rank ला tie असेल तर Nपेक्षा जास्त rows येऊ शकतात. Deterministic selection हवी तर secondary sort key द्या. Calculated Top 10 Stores table refresh ला बदलते; slicerला dynamic top10 हवं तर visual filter किंवा measure वापरा.

फक्त chart मध्ये top10 दाखवण्यासाठी Filters pane मधला Top N पुरू शकतो. Share सारखा calculation हवा तेव्हा DAX उपयोगी.