Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Cumulative line (Whale Curve)

Hi,


I'm trying to make a cumulative line based on sales to each customer.

Currently I have sales and customers in a graph but the amount does not add up (blue line). How to make it like shown(in red) in the picture?


Thanks in advance

14 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Try this 

    Var _date = max(date column)

    Measure=

        calculate(sum(sales),keepfilters( All(date column) <= _date) )

     

     

    replace your date column 

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Baskar,

       

      Doesn't seem to work:

      1. OmzWhale = 
      VAR var_Date = max(Dates[Date])
      Measure = CALCULATE(SUM(TB[Amount]),KEEPFILTERS(ALL(Dates[Date]) <= var_Date))

      This gives error: The syntax for Measure is incorrect.

      1. OmzWhale = 
      VAR var_Date = max(Dates[Date])
      Return CALCULATE(SUM(TB[Amount]),KEEPFILTERS(ALL(Dates[Date]) <= var_Date))

      This gives "The true/false expression does not specify a column."

      • richbenmintz's avatar
        richbenmintz
        Icon for Resident Rockstar rankResident Rockstar

        Hi Anonymous,

         

        please try

         

        OmzWhale = 
        VAR var_Date = max(Dates[Date])
        Measure = CALCULATE(SUM(TB[Amount]),FILTER(ALL('Dates'),Dates[Date]) <= var_Date))

        Hope this Helps,
        Richard


        Did I answer your question? Mark my post as a solution!
        Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!