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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.