Forum Discussion

Luis_Caston's avatar
Luis_Caston
Helper III
2 years ago

Pareto table

Dear all!

I need you support please!
I've been working with this code to make a Pareto:
https://www.daxpatterns.com/abc-classification/ 

I've been applying this solution:

 

"ABC Class =
IF (
    HASONEVALUE(Cliente[Cliente]),
    VAR SalesByProduct =
        CALCULATETABLE (
            ADDCOLUMNS (
                SUMMARIZE(Cliente, Cliente[Cliente]),
                "@ProdSales", [Total Venta Analitico]
            ),
            ALLSELECTED (Cliente[Cliente])
        )
       
    VAR AllSales =

        CALCULATE(
        [Total Venta Analitico], ALLSELECTED(Cliente))
           
    VAR CurrentSalesAmt = [Total Venta Analitico]
    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.81, "A",
            CurrentCumulatedPct <= 0.9, "B",
            "C"
        )
    RETURN
        Result

"

And I've two doubts:
1 - How can I insert a paremeter to make it dinamic? I'd like to select from: Family, client and so on dinamically.
2 - To use the ABC as a filter y make a new table but when I try to relationate it with the Client table I obtain an error: Circular dependence. Do you know why?

Pareto 

4 Replies

  • Dear all,

    I've seen that to make it dinamyc an avoid this error: Calculation error in measure Param: Column Param is part of composite key, but not all columns of the composite key are included in the expression or its dependent expression.


    I'm following this example: Error solution   and I'm changing the beginning as follows:

    ABC Class =
    IF (
        SELECTCOLUMNS(
            SUMMARIZE(
                'Parámetro', 'Parámetro'[Parámetro], 'Parámetro'[Parámetro Campos]), at the example indicates here "Parameter[Parameter]" but I'm not able to type it.

    Do you know why?
    • Luis_Caston's avatar
      Luis_Caston
      Helper III

      Dear amitchandak !
      Thank you for your support.
      I've followed the example and ok I've figures the second point is: How do I make it dinamical?

      At this part of the code I've tested it by client and I works:

      Net Count ABC =
          SUMX( 'ABC Bucket',
              CALCULATE(
                  SUMX(
                      FILTER(
                          VALUES(
                              Cliente[Cliente]),
                                  [ABC V2 Luis] = MAX('ABC Bucket'[ABC])),
                                  [Total Venta Analitico])))
       
      But If if change "Cliente[Cliente]" by a 'Parameter[Parameter] I obtain the next error:Calculation error in measure [Net Count ABC]: Column [Parameter] is part of composite key, but not all columns of the composite key are included in the expression or its dependent expression.