How to find best-selling items in Power BI using MAXX

View profile for Chandeep Chhabra

Power BI Trainer and Consultant

Context Transition in Power BI  Three similar-looking formulas. Three completely different mechanisms. Let me break it down 🛠️ 📅 Example 1: Best Selling Day We have an existing Calendar table in our data model. Since it's structured at the day level, MAXX iterates through each day, calculates [Total Sales] for that specific day, and returns the maximum. The granularity of the Calendar table determines that we get the best-selling day. 📦 Example 2: Best Selling Product Same logic, different table. Our Products table exists at the SKU level (product code level). MAXX iterates through each product, evaluates [Total Sales] for that product, and returns the winner. The table's granularity gives us the best-selling product. 🗺️ Example 3: Best Selling Region Here's where it gets interesting. We don't have a dedicated dimension table for regions in our data model. So we create a virtual table using VALUES(Sales[Region]). This extracts all unique regions from the Sales table, and MAXX can then iterate through them to find the best-selling region. 🔑 The key insight: Context transition happens when MAXX iterates and converts each row into a filter context for the measure to evaluate. But the granularity of what you're iterating over, whether it's a physical dimension table or a virtual table, determines what "best" actually means. Physical tables = leverage your data model structure  Virtual tables = create analysis paths that don't exist in your model #PowerBI #DAX

  • diagram
Renata Costa

Senior Data Analyst at @Lojas Renner

3w

I love this kind of content, when we can see dax’s power!!! Thanks a lot

Mythily R.

Experienced Data Analyst | SQL & Python Enthusiast | Power BI Specialist | Strategic Decision Maker 📊🐍🔌 #DataAnalysis #SQL #Python #PowerBI #BusinessIntelligence

3w

It's interesting that simply providing the table automatically takes us to the most granular level of data available. Is that correct?

Like
Reply
Eser Karaceper

Data Analyst 📉 | DAX Ninja 🥷| Power BI Developer 📊 | Business Intelligence Specialist 👨💻

2w

This is a really good example. Especially for those who are new to Power BI, the context transition concept can be quite confusing. Seeing more content like this would be really helpful for understanding data-related concepts better.

Like
Reply
Vandana M.N

Data Analysis | Power BI | DAX | Python | SQL 5⭐| Advanced Excel | Data Visualization | Ecommerce

3w

Really appreciate. Please come up with more ideas on context transition.

Like
Reply

Nice, allthough I think top3 is more interesting, and I think you would go No Calculate then, right?

Like
Reply
Pranav Ingale

BI Lead at Accenture Microsoft DP-600 Certified | Microsoft PL-300 Certified | Microsoft GH-300 | SAP C_BCFIN_2502 | Power BI | Gen AI | Azure | SQL | SAP | Data modelling | Machine Learning | BI | MS Fabric

1w

Amazing

Like
Reply
Niranjan Rana

Data Analyst & Power BI Developer | Power BI, SQL, PySpark & Python | Data Modelling | Automation & Insights – Immediate Joiner

3w

Key - Find the exact level of Granularity where you want the calculation.

Like
Reply
Phillip Seefeld

Excel & Power BI Analyst 👨🏻💻 | From data jungle to clear decisions 💡 | I transform raw data into tailored analyses & automated reports 📊 for SMEs 🏢 | Controlling 🧮 | Matcha Enthusiast 🍵

3w

Love your reminders of the basics, thanks Chandeep!👍🏻 Regards, Phillip 🙋🏻♂️

Like
Reply
See more comments

To view or add a comment, sign in

Explore content categories