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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
AlexandruP
Frequent Visitor

Count of dynamic ABC measure

Hi,

 

I have a dynamic ABC measure that calculates top 80% of sales by product nr, further 15% and last 5% (A,B and C products)

using the Microsoft tutorial on Dynamic ABC. Howerer I am unable to perform a count of A,B,C's. Each product is coming from a supplier and is part of a subcategory of products. If i have a table with all products I can see which product is A, which B and C. 

 

But I want to be able to have a table with all suppliers and then a measure to count how many A,B,C product I have for each supplier.

 

Current measure for Dynamic ABC is the following :

 

ABC Oms =
IF (
    HASONEVALUE ( D_Vare[Varenr] ),
    VAR SalesByProduct =
       
           
            CALCULATETABLE (
            ADDCOLUMNS (
                SUMMARIZE ( F_Butikssalg, D_Vare[Varenr] ),
                "@ProdSales", [Oms. kr.]
            ),
            ALLSELECTED ( D_Vare )
        )
    VAR AllSales =
        CALCULATE (
            [Oms. kr.],
            ALLSELECTED ( D_Vare )
        )
    VAR CurrentSalesAmt = [Oms. kr.]
    VAR CumulatedSales =
        FILTER (
            SalesByProduct,
            [@ProdSales] >= CurrentSalesAmt
        )
    VAR CumulatedSalesAmount =
        SUMX (
            CumulatedSales,
            [@ProdSales]
        )
    VAR CurrentCumulatedPct =
        DIVIDE (
            CumulatedSalesAmount,
            AllSales
        )
    VAR Result =
        SWITCH (
            TRUE,
            ISBLANK ( CurrentCumulatedPct ), BLANK (),
            CurrentCumulatedPct <= 0.8, "A",
            CurrentCumulatedPct <= 0.95, "B",
            "C"
        )
    RETURN
         Result
       
)
1 REPLY 1
amitchandak
Super User
Super User

@AlexandruP , Window function with small modification to this

Power BI Window function- Pareto Analysis, 80% of sales, Order by on Measure: https://www.youtube.com/watch?v=UVxiLc_AzSs

 

or

 

Power BI Window function- TOP N% with Others: https://youtu.be/rQElaRoPbUA

 

can help

 

or

https://www.daxpatterns.com/abc-classification/

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.