Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Cumulative Line Target in Chart

I am tying to make a cumulative line target appear in the chart. The line must start with the value given by the measure and then it gets added by itself for each day. For example: if the target value in the first day is 5, for second day will be 10, the third will 15, and so on... 

 

Here is the measure that I am currently using:

 

Cumulative_Target =
CALCULATE(
SUM(Meta_Comp_Alim[Meta_Alim_Diaria]),
FILTER(
ALLSELECTED(Date_Table),
Date_Table[Date_Column] <= MAX(Date_Table[Date_Column])
)
)
 
The above measure will always give a constant value (because the table has values for the first day only)

 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

     

    Make sure the start measure always returns static value for each day.

    Then rank the days on x-axis and multiply by [measure].

    Cumulative_Target = [Measure]*RANKX(ALLSELECTED(Date_Table),CALCULATE(SELECTEDVALUE(Date_Table[day])),,ASC)

     

    Best Regards,

    Jay

3 Replies

  • Hi Anonymous,
    Is the x-axis in your chart equal to Date_Table[Date_Column]? If not, try changing your calculation to:

    Cumulative_Target =
    CALCULATE(
    SUM(Meta_Comp_Alim[Meta_Alim_Diaria]),
    FILTER(
    ALLSELECTED(Date_Table),
    **x-axis value** <= MAX(**x-axis value**)
    )
    )

    Hope this helps!
    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you for your reply claymcooper  .

      The x-axis in the chart is not equal to Date_Table[Date_Column], but it's from the same table. Your suggestion won't work.

       

       

       

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    Make sure the start measure always returns static value for each day.

    Then rank the days on x-axis and multiply by [measure].

    Cumulative_Target = [Measure]*RANKX(ALLSELECTED(Date_Table),CALCULATE(SELECTEDVALUE(Date_Table[day])),,ASC)

     

    Best Regards,

    Jay