Forum Discussion
Classification count by Product Range
- 1 year ago
Hi Anonymous
Thank you for reaching out to the Microsoft Fabric community. And thank you lbendlin and Elena_Kalina for sharing helpful insights.
We have implement a combination of calculated columns and a measure within the dataset. The classification logic categorizes products into EXCELLENT, V GOOD, and GOOD tiers based on their contribution to total sales, with thresholds at 70%, 90%, and 100% respectively.
--------Measures------- TotalSalesPerType = CALCULATE( SUM('SalesData'[Sales]), ALLEXCEPT('SalesData', 'SalesData'[Type]) ) ----------------- Product Count = DISTINCTCOUNT('SalesData'[Product]) ---Calculated Columns--- CumulativeSales = CALCULATE( SUM('SalesData'[Sales]), FILTER( 'SalesData', 'SalesData'[Type] = EARLIER('SalesData'[Type]) && 'SalesData'[Sales] >= EARLIER('SalesData'[Sales]) ) ) ------------------------------ CumulativePercent = DIVIDE('SalesData'[CumulativeSales], [TotalSalesPerType]) ------------------------------ Classification = SWITCH( TRUE(), 'SalesData'[CumulativePercent] <= 0.7, "EXCELLENT", 'SalesData'[CumulativePercent] <= 0.9, "V GOOD", "GOOD" )
Please refer to the attached .pbix file for a working example and review the implementation.
I hope this information proves helpful. If not, please feel free to share additional details, and we will be happy to assist you further.
Regards,
Karpurapu D,
Microsoft Fabric Community Support Team.
Hi Anonymous
Thank you for reaching out to the Microsoft Fabric community. And thank you lbendlin and Elena_Kalina for sharing helpful insights.
We have implement a combination of calculated columns and a measure within the dataset. The classification logic categorizes products into EXCELLENT, V GOOD, and GOOD tiers based on their contribution to total sales, with thresholds at 70%, 90%, and 100% respectively.
--------Measures-------
TotalSalesPerType =
CALCULATE(
SUM('SalesData'[Sales]),
ALLEXCEPT('SalesData', 'SalesData'[Type])
)
-----------------
Product Count = DISTINCTCOUNT('SalesData'[Product])
---Calculated Columns---
CumulativeSales =
CALCULATE(
SUM('SalesData'[Sales]),
FILTER(
'SalesData',
'SalesData'[Type] = EARLIER('SalesData'[Type]) &&
'SalesData'[Sales] >= EARLIER('SalesData'[Sales])
)
)
------------------------------
CumulativePercent =
DIVIDE('SalesData'[CumulativeSales], [TotalSalesPerType])
------------------------------
Classification =
SWITCH(
TRUE(),
'SalesData'[CumulativePercent] <= 0.7, "EXCELLENT",
'SalesData'[CumulativePercent] <= 0.9, "V GOOD",
"GOOD"
)
Please refer to the attached .pbix file for a working example and review the implementation.
I hope this information proves helpful. If not, please feel free to share additional details, and we will be happy to assist you further.
Regards,
Karpurapu D,
Microsoft Fabric Community Support Team.
fantastic and really support me to sort out the solution.
steps you explained in DAX and really amazing .. awesome, Thank you
- v-karpurapud1 year agoCommunity Support
Hi Anonymous
I'm happy it was useful for you. If you have any questions,please feel free to reach out.
Regards,
Karpurapu D.