Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be 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

Reply
DM_95
Helper I
Helper I

Convert measure to calculated column?

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!

2 REPLIES 2
v-xuxinyi-msft
Community Support
Community Support

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

lbendlin
Super User
Super User

You cannot create a calculated column from a filter selection.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.