Forum Discussion

corange's avatar
corange
Post Patron
6 years ago

ABC Analysis

Hi everyone, I am trying to integrate the ABC Classfication in Power BI, however, I am struggling with how to integrate filters. This is the formula I have used:

 

Amount ABC =

var Outer =

ADDCOLUMNS(

    VALUES(Jobs_Details[CLIENT_CODE]),

    "OuterValue", [Gross Profit]

)

var Inner  =

ADDCOLUMNS(

    ALL(Jobs_Details[CLIENT_CODE]),

    "InnerValue", [Gross Profit]

)

return

CALCULATE(

    [Gross Profit],

    VALUES(Jobs_Details[CLIENT_CODE]),

    FILTER(

        CALCULATETABLE(

            ADDCOLUMNS (

                Outer,

                "CumulatedPercentage", DIVIDE (

                    SUMX (

                        FILTER (

                            Inner,

                            [InnerValue] >= [OuterValue]

                        ),

                        [InnerValue]

                    ),

                    CALCULATE (

                        [Gross Profit],

                        VALUES (Jobs_Details[CLIENT_CODE])

                    )

                )

            ),

            ALL(Jobs_Details)

        )

        , [CumulatedPercentage] > CALCULATE( MIN('ABC Class'[LowerBoundary]) )

        && [CumulatedPercentage] <= CALCULATE( MAX('ABC Class'[UpperBoundary]) )

    )

)

The issue is that when I select another filter such as a Rate Table Number so I could see all Class A client that uses a specifc pricing strategy, it will grouped all client under Class A while originally without that filter selected, the client is a Class C. Moreover, when I try to look for a specific client using the search function, I can see the client is duplicate with only information attached to one Class however, it is the wrong class too. Any idea how to fix this so it is dynamic no matter which filter is used? Thank you.

4 Replies

  • v-yuta-msft's avatar
    v-yuta-msft
    Community Support

    corange ,

     


    The issue is that when I select another filter such as a Rate Table Number so I could see all Class A client that uses a specifc pricing strategy, it will grouped all client under Class A while originally without that filter selected, the client is a Class C. Moreover, when I try to look for a specific client using the search function, I can see the client is duplicate with only information attached to one Class however, it is the wrong class too. Any idea how to fix this so it is dynamic no matter which filter is used? Thank you.


    I'm quite confused on your description. could you share more details about this issue? (e.g.: relationship between Rate Table and Fact table, which column are you trying to divide and what does the search expression look like)

     

    Community Support Team _ Jimmy Tao

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • corange's avatar
      corange
      Post Patron

      Hi, 

       

      THanks for your reply. 

       

      Can I share my document with you privately somehow? 

      • v-yuta-msft's avatar
        v-yuta-msft
        Community Support

        corange ,

         

        Please do not sent the orginal file. You can make a simple sample file, upload the file to onedrive and share the link here.

         

        Regards,

        Jimmy Tao