Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Administrator
9 months ago
Solved

Cumulative per customer

Nice day I have a table called LoadItems. This table has these fields: - FEC Dispatch related to Dim_Calendar DAX with the Date field; it is a relationship that is kept but not active because it g...
  • Zanqueta's avatar
    Zanqueta
    9 months ago

    Hello Syndicate_Admin, let me try.


    To achieve this, you need to create DAX measures that accumulate the M2 Dispatched values per Client and Year, ordered from highest to lowest, and then calculate the cumulative percentage.

     

    Suggested DAX Measures:

    Total M2 Dispatched per Client and Year
    TotalM2PerClientYear =
    CALCULATE(
        SUM(LoadItems[M2 Dispatched]),
        ALLEXCEPT(LoadItems, LoadItems[Client], LoadItems[Year])
    )

    Accumulated M2 Dispatched for Pareto

     

    AccumulatedM2Pareto =
    VAR CurrentClient = SELECTEDVALUE(LoadItems[Client])
    VAR CurrentYear = SELECTEDVALUE(LoadItems[Year])
    RETURN
    CALCULATE(
        SUM(LoadItems[M2 Dispatched]),
        FILTER(
            ALL(LoadItems),
            LoadItems[Year] = CurrentYear &&
            LoadItems[M2 Dispatched] >= 
                CALCULATE(SUM(LoadItems[M2 Dispatched]), LoadItems[Client] = CurrentClient)
        )
    )

    Cumulative Percentage

     

    CumulativePercentage =
    DIVIDE(
        [AccumulatedM2Pareto],
        CALCULATE(SUM(LoadItems[M2 Dispatched]), ALL(LoadItems), LoadItems[Year] = SELECTEDVALUE(LoadItems[Year]))
    )