Forum Discussion

readyOH's avatar
readyOH
Frequent Visitor
10 years ago
Solved

Cumulative percentage (CALCULATE FUNCTION)

Hi,   For cumulative data, I use CALCULATE SUM AND FILTER functions. it works pretty well For example, if i want to have the cumulative sales SalesCumul = CALCULATE(SUM('Table1'[Sales]);FILTER(AL...
  • ALeef's avatar
    ALeef
    10 years ago

    Ahh, so you are looking for attainment of goal.  That makes more sense now.

     

    So currently, you have Column E (from your example) working - and Column F is what you are trying to solve?

     

    In that case, if you need to keep static numbers for each month ( i.e. in February we had saved 5, and at that time, were at .69% of our 7% goal ) you need to use a calculated column for the SavingsCumul, not a measure.

     

    Your columns will be as follows : (using pseudo-code, not actual syntax - new/changed columns bolded )

     

    Savings: <fact data>

    Purchase: <fact data>

    SavingsCumul: calculate sum of [Savings], filtered by [month], where [month] <= [month]

    MonthlySavings: [savings] / [purchase] (and then format the column as a percent)

    Attainment of goal to date : [savingsCumul] / [PurchasesYTD] (format as percentage)

     

    Then you can add the measure : PurchasesYTD: = calculate sum of [purchases]

     

    Then you will be able to see your percentage of savings for each month, as compared to total purchases.  Keep in mind that those percentages in the Attainment column will change when you refresh your data

     

     

    Below is a theoretical discussion of analytics, and not at all related to answering your question.  Feel free to ignore it if you wish.:

     

    Keep in mind that those percentages in the Attainment column will change when you refresh your data ... so realistically, the only number that makes a difference in terms of tracking your KPIs, will be the last month anyways.  Not trying to be a jerk - as I don't understand your particular situation - just, as a Business Analyst, knowing how much we had saved in February as a percentage of what we sold YTD, is a useless metric.  I would be interested in knowing "how much have we saved YTD compared to purchased YTD?" - which is what your first set of measures was calculating fine.  If you need to track it over time, then it makes sense to track Cumulative Savings vs Cumulative Purchases - to find out your percentage to goal as of that month.  But doing it vs YTD doesn't make sense.