🚀 Power BI Interview Challenge #4 🔥
𝗜𝗻𝘁𝗲𝗿𝘃𝗶𝗲𝘄𝗲𝗿: You have 2 minutes to solve this Power BI problem.
You have a Sales table with the following columns: Product Sales
Create a DAX measure to calculate the percentage contribution of each product to total sales.
𝗠𝗲: Challenge accepted! 💪
Sales Contribution % = DIVIDE( [Total Sales], CALCULATE( [Total Sales], ALL(Sales[Product]) ), 0 )
💡 Explanation: This measure calculates how much each product contributes to the total sales. • [Total Sales] returns the sales for the current product. • ALL(Sales) removes the product filter while keeping other filters intact. • CALCULATE() recalculates the total sales after removing the product filter. • DIVIDE() safely performs the division and avoids divide-by-zero errors.
This challenge tests your understanding of: ✅ CALCULATE() ✅ ALL() ✅ DIVIDE() ✅ Filter Context ✅ Percentage Calculations
🎯 Expected Output Example Product | Sales | Sales Contribution % Laptop | 50,000 | 50% Mouse | 20,000 | 20% Keyboard | 15,000 | 15% Monitor | 15,000 | 15%
🚀 Bonus (Dynamic Percentage by Selected Filters)
Sales Contribution % = DIVIDE( [Total Sales], CALCULATE( [Total Sales], ALLSELECTED(Sales[Product]) ), 0 )
Using ALLSELECTED() respects slicers and page filters while removing only the product filter, making the measure more interactive.
🚀 Tip for Power BI Job Seekers: Understanding the difference between these functions is crucial for interviews: • ALL() → Removes all filters from the specified column or table. • ALLSELECTED() → Respects user selections made through slicers and filters. • REMOVEFILTERS() → Modern alternative to remove filters in many scenarios.
These are among the most frequently asked DAX concepts in Power BI interviews.
Power BI Resources: https://whatsapp.com/channel/0029Vai1xKf1dAvuk6s1v22c
❤️ React with ❤️ for more Power BI interview challenges!