March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi everyone,
Is there a solution to convert below measure to a calculated column?
ABC Classification =
IF(
// Check if there is only one product selected
HASONEVALUE('Product'[Item]),
// Calculate total sales for all selected products
VAR AllSales = CALCULATE(
[Total Quantity L12M],
ALLSELECTED('Product')
)
// Store the current total sales amount
VAR CurrentSalesAmount = [Total Quantity L12M]
// Calculate cumulative sales for products with sales amount greater than or equal to the current sales amount
VAR CumulatedSales = CALCULATE(
[Total Quantity L12M],
FILTER(
ALL('Product'),
[Total Quantity L12M] >= CurrentSalesAmount
)
)
// Calculate the current cumulative percentage of sales
VAR CurrentCumulatedPercent = DIVIDE(
CumulatedSales,
AllSales
)
// Return ABC classification based on cumulative percentage
RETURN
SWITCH(
TRUE(),
ISBLANK(CurrentCumulatedPercent), BLANK(), // If there is no sales data, return blank
CurrentCumulatedPercent < 0.8, "A", // If cumulative percent is less than 0.8, classify as "A"
CurrentCumulatedPercent <= 0.95, "B", // If cumulative percent is less than or equal to 0.95, classify as "B"
"C" // Otherwise, classify as "C"
)
)
Thank you in advance!
Hi @DM_95
@lbendlin , thanks for your concern about this case.
I couldn't test it without any data. Could you please provide me with sample data and the results based on these sample data? That would be very helpful. [Total Quantity L12M] looks like a measure, could you please give the calculation of the formula?
Or show them as screenshots or pbix. Please remove any sensitive data in advance. If uploading pbix files please do not log into your account.
Best Regards,
Yulia Xu
You cannot create a calculated column from a filter selection.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
87 | |
87 | |
70 | |
51 |
User | Count |
---|---|
205 | |
153 | |
97 | |
79 | |
69 |