Рет қаралды 11
🎯 Mastering DAX: Simplifying Profit % and Loss % Calculations 🎯
🚀 Excited to share a recent DAX query I worked on to calculate Profit % and Loss % at the product level in Power BI. It's a great way to dynamically analyze financial performance while ensuring accuracy with safe calculations.
Here’s the query:
EVALUATE
ADDCOLUMNS(
SUMMARIZE(
financials,
financials[Product]
),
"Profit %",
DIVIDE(
SUM(financials[Profit]),
SUM(financials[Sales]),
0
),
"Loss %",
DIVIDE(
SUM(financials[Sales]) - SUM(financials[Profit]),
SUM(financials[Sales]),
0
)
)
What it Does:
✅ Groups the data by Product.
✅ Calculates Profit %: (Profit ÷ Sales).
✅ Calculates Loss %: ((Sales - Profit) ÷ Sales).
✅ Handles division-by-zero scenarios gracefully using the DIVIDE function.
Why This Matters:
📊 Understanding profitability and losses at the product level is crucial for decision-making.
⚙️ Power BI and DAX make it easy to create powerful and reusable formulas like this one.
💡 Pro Tip: Adding calculated measures in your reports not only adds value but also makes your data storytelling more insightful!
Are you also exploring advanced DAX? Let’s connect and discuss ideas! 🤝
#PowerBI #DAX #DataAnalytics #FinancialAnalysis #Profitability #DataEngineering #LinkedInLearning