[Power BI] DAX ALL Function Practical Series ② Ranking Part 4: Cross Ranking Analysis (Store × Product)


In Part 3, we categorized the strategic grades of products. Now, it is time to combine the contexts of Store and Product. This is because a product that is number one company-wide might actually be the worst performer in a specific store, or a small store might achieve top rank in a specific category.

In this Ranking Part 4, we will use the ALL family of functions to master the design of "Cross Ranking," which intersects the contexts of stores and products.

Store * Product Matrix


 

1. Analysis Data Overview: H1 2024 IT Device Sales

  • Stores: New York (NY), Los Angeles (LA), Chicago, Houston
  • Products: iPhone 15, MacBook Air, Galaxy S24, Pixel 8, Surface Pro
We analyze sales data based on 4 stores × 5 major product lines. The dataset includes monthly records for 2024, tracking sales amounts for each product across these flagship and mall locations.

Monthly sales data by store


 

2. Why is Cross Ranking Necessary?


While a Global Rank shows the macroscopic market structure, Cross Ranking analysis is a strategic indicator that captures regional consumption patterns and store-specific anomalies.

Typical use cases include:

① Product Ranking within a Store 

Store managers can use this information to make critical decisions: "What are our customers most enthusiastic about?" → Leading to optimized display and inventory.

② Store Ranking by Product 

The headquarters marketing team can establish strategies such as: "Where is the 'holy land' for this specific product?" → Leading to optimized logistics distribution and regional marketing targeting.

Ultimately, Cross Ranking analysis is a key analytical tool that connects corporate strategy with field operations.


 

3. DAX Design: Shifting the Context


The core of Cross Ranking is "what to ignore and what to leave behind." The three main functions used for this are:
  • ALL: Removes all filters.
  • ALLEXCEPT: Maintains filters only on specific columns.
  • ALLSELECTED: Maintains filters selected by the user.

In practical dashboards, ALLSELECTED is the primary choice because responsiveness to slicers is essential.


[All vs. ALLSELECTED] coming soon

[ALL function (All vs ALLSELECTED vs. ALLEXCEPT)] coming soon


3.1 Rank within Store "What is the rank of this product's performance within our specific store?"

  • Strategic Value & Utilization:
Field Optimization: It serves as an objective indicator for identifying unique consumption patterns of a specific store to determine display positions and stock levels.
Performance Diagnosis: If a company-wide #1 product is underperforming in a specific store, it serves as a key KPI helping store managers decide whether to check the display status or local competitor activity.

Pro Tip: What happens if you forget ISINSCOPE? 
The most common mistake for beginners is omitting ISINSCOPE. If you leave it out, the "Total" row of a matrix will always display a rank of 1. This is because the total amount only compares itself to itself, making it #1. To keep your report clean, always ensure the calculation is controlled to run only at the "Product" level.

3.2 Rank within Product "Which store in the country sells this product the best?"

  • Strategic Value & Utilization:
Visualizing Competitive Structure: By comparing performance across stores for a specific product, you can grasp the sales competitiveness of each store at a glance.
Logistics & Marketing: It serves as the core evidence for logistics optimization—such as prioritizing inventory for stores with rising ranks—and for measuring regional promotion efficiency. This is essential for sophisticated headquarters marketing strategies.


 

4. ALL vs. ALLSELECTED: Practical Differences


While we used ALL for absolute ranking in Parts 1 and 2, ALLSELECTED is the correct answer for dashboards where user interaction is important.

ALL vs. ALLSELECTED: Practical Differences

Why ALLSELECTED?

If you select only [Samsung, Apple] in a slicer:
  • ALL might still show a product as #4 because it includes invisible products.
  • ALLSELECTED recalculates the rank as #1 or #2 within that selected list. This maintains the analysis context set by the user and prevents confusion in data interpretation.


 

5. Practical Data Analysis: Store × Product Matrix


Comparing the cross-rankings of New York and Chicago:

Comparing the cross-rankings of New York and Chicago

New York Flagship

  • Insight: In New York, the local rankings mirror the global rankings. New York's performance essentially determines the overall corporate trend. Any drop in rank here could severely impact company-wide revenue, making these Local Rank fluctuations the most sensitive KPIs for headquarters.

Chicago Central

  • Insight: While Apple products are concentrated in New York, Chicago acts as a stronghold for the Android camp. Even if the headquarters runs iPhone-centric integrated marketing, they should allocate a separate budget for Galaxy promotions specifically for the Chicago branch.


 

6. Conditional Formatting in Matrix Visualizations


Store * Product Matrix

Once you have calculated Cross Rankings, utilize [Conditional Formatting] -> [Background Color] in your Matrix visualization.
  • Rule: Set a deep red for a "Rank within Store" of 1, and lighter colors as the rank decreases.
  • Effect: This creates a Heatmap that allows you to see at a glance which category is the "star player" for each store.


 

Wrapping up


Cross Ranking analysis is the "redefinition of performance based on context."
  • Global Rank shows the overall market dominance of the company.
  • Cross Rank allows for the establishment of customized tactics suitable for the field (store/region).

By freely combining RANKX and the ALL family of functions, you can accurately locate the position of data under any complex filter situation.

What’s Next?

Part 5 — Rank Change Analysis "Why did a product that was 5th last month rise to 2nd this month?" We will move beyond simple current rankings to learn how to calculate and visualize rank trends over time using arrow-based dashboards.



<Other posts on the blog>





Comments

Popular posts from this blog

DAX CALENDAR Function Deep Dive and Practical Usage Guide

Standard Deviation (Part 2): Strategic Limitations and Complementary Perspectives in Standard Deviation Analysis

Standard Deviation (Part 1): Measuring Data Volatility and Using the Insights for Better Strategy