Forum Discussion

miikasa's avatar
miikasa
Frequent Visitor
2 years ago
Solved

Accumulated Values in a bar chart

Hi guys,

 

I have this measure which is linked to a calendar table:

 

SalesIndex =
DIVIDE(
    [SalesAmount],
    [AverageCurrentMonthPreviousMonth],
    0
)
 
Calendar = CALENDAR(DATE(2022,01,01),TODAY())
 
Now I need to show the accumulated values by year in a bar chart, like:

AccumulatedSalesIndex2023: sum of sales index 2023
AccumulatedSalesIndex2024: sum of sales index 2024

Can anyone give me any tip on how can I do that? I tried to sum up the values and it worked, but when I put in the chart, it doesn't appear properly.

Thank you in advance.
 
  • Hi miikasa 

    Could you try:
    Running total =
    Calculate(
    [SalesIndex]

    , Calendar[Date] <= Max(Calendar[Date]) --Filter to less than the current max
    , Year(Calendar[Date]) = Year(Max(Calendar[Date])) --keep in the same year
    )

6 Replies

  • Hi miikasa 

    Have you tried the TotalYTD function?

    Total YTD =
     TOTALYTD(
        [Sum of Quantity] --Measure to calculate
        ,'Calendar table'[Date] --Calendar table and date
        ,"31 Dec" --Optional end of year
     )
    • miikasa's avatar
      miikasa
      Frequent Visitor

      Hi SamWiseOwl,

       

      Thank you for suggestion.

       

      Sorry, I didn't explain clearly.

      What I really need is to add a new category in the x-axis and show the accumulated measure. Now when I try to add, it just shows the values by month. Do you have any suggestion on how to do it?

      Thank you again.

      • SamWiseOwl's avatar
        SamWiseOwl
        Icon for Super User rankSuper User

        Hi miikasa 

        Could you make a mock up of what you have and what you want please 🙂