Forum Discussion

Kolumam's avatar
Kolumam
Icon for Post Prodigy rankPost Prodigy
8 years ago
Solved

Calculating running total based on month

Hi All, 

 

How do I calculate running total of yield based on Month. If it's not poosible I also have Month number. Can you please help?

  • Kolumam,

     

    Try using the below measure:

    Measure =
    CALCULATE(
        SUM(Example[Value]),
        FILTER(ALL(Example), Example[Num] <= MIN(Example[Num]))
    )

     

    Hope this helps.

    If this solves your problem please mark as solution.

19 Replies

  • Hi,

     

    With a little bit of effort, this should be simple to solve.  Ensure you have a Calendar Table.  Create a relatioship from the Date column of your base table to the Date column of your Calendar Table.  In the Calendar Table, enter this formula in a column to extract the Month name

     

    =FORMAT(Calendar[Date])

     

    Now drag the Month from the Calendar Table to your visual.  Enter this formula to calculate running yield

     

    =CALCULATE([Yield],DATESYTD(Calendar[Date],"31/12"))

     

    Hope this helps.

  • anandav's avatar
    anandav
    Icon for Skilled Sharer rankSkilled Sharer

    Kolumam,

     

    You want a running total (cummulative total).

    Check the link below how to do it,

    https://whatthetechisthat.wordpress.com/2017/05/30/power-bi-cumulative-totals/

     

    If your date field in below table is a date heirarchy, then you can choose only month (and year if you need). You need to have a calendar table and establish relatship with your data table.

     

     Running Toal Measure =

          CALCULATE(

              Sum(Table[Yield],

              FILTER(All(Dim_Date[Date]), Dim_Date[Date] <= MAX(Dim_Date[Date]

              )

            )

    • Kolumam's avatar
      Kolumam
      Icon for Post Prodigy rankPost Prodigy

      I don't have a date field. All I have is a month field which is a text field and a month number.

      • anandav's avatar
        anandav
        Icon for Skilled Sharer rankSkilled Sharer

        Kolumam,

         

        Try using the below measure:

        Measure =
        CALCULATE(
            SUM(Example[Value]),
            FILTER(ALL(Example), Example[Num] <= MIN(Example[Num]))
        )

         

        Hope this helps.

        If this solves your problem please mark as solution.