Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Running total that uses date slicer

Hi,

 

I am read several posts about trying to come up with a running total that uses a date slicer. I keep finding the same dax formula and it is not helping me with my situation.

 

Running Total =
CALCULATE (
SUM ( Table[column] ),
FILTER ( ALL ( Table ), Table[columnDate] <= MAX ( Table[ColumnDate] ) )
)

 

I am trying to set up a clustered column graph that will show a running total of words in progress on filters applied -- a date slicer. I want to see my running total lower when I adjusted the date on my date slicer.

 

Is there anyone that can help me accomplish this? Any assistance or guidance is greatly appreciated!

 

Thank you!

 

Example, I want to have a running total of 5000 on 7/25/18. The next day 1000 words are delivered, so when I change my date slicer to 7/26/18 I want my running total to display 4000. 

  • Hi Anonymous

    create a new table with fomula below, then create a measure in that table, next edit relationship between this new table and your original data table, finally add the column "Finish Date" from this new table to the slicer.

    Table = VALUES(Table1[Finish Date])
    
    selected = SELECTEDVALUE('Table'[Finish Date])

     

    Then create a measure in your data table

    Measure =
    CALCULATE (
        SUM ( Table1[Words] ),
        FILTER (
            ALLEXCEPT ( Table1, Table1[Person] ),
            [Finish Date] <= MAX ( Table1[Finish Date] )
                && [Finish Date] >= [selected]
        )
    )

     

     

    Best Regards

    maggie

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous

     

    Can you please share the sample data in table format ( In Copy - pastable format, not as snapshot)  with expected result ?

     

    Thanks
    Rah

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous

     

    Thank you for responding to my post. Here is some sample data.

     

    PersonWordsStart DateFinish DateRunning Total
    ABS25004/27/20185/1/2018                 2,500
    ABS23004/27/20185/2/2018                 4,800
    ABS5005/13/20185/26/2018                 5,300
    ABS15005/10/20185/31/2018                 6,800
    ABS23006/10/20186/26/2018                 9,100
    ABS10007/1/20187/15/2018               10,100
    ABS12007/3/20187/18/2018               11,300
    AC1003/10/20183/24/2018                     100
    AC4004/1/20184/16/2018                     500
    AC9004/12/20184/29/2018                 1,400
    AC1004/28/20185/8/2018                 1,500
    AC10005/5/20185/20/2018                 2,500
    AD12004/2/20184/19/2018                 1,200
    AD16004/20/20185/1/2018                 2,800
    AD8005/6/20185/16/2018                 3,600
    AD23005/19/20186/1/2018                 5,900
    AD40006/2/20186/15/2018                 9,900
    AD35006/7/20186/23/2018               13,400
    AD30007/1/20187/17/2018               16,400

     

    PersonRunning Total
    ABS49,900
    AC6,000
    AD53,200

     

    PersonRunning Total using slicer
    ABS42,600
    AC4,000
    AD49,200

     

    I am looking for a formula that will work with the date slicer on my visuals. I want to look at a specific date. For example, 5/1/2018. I want to have power bi do a running total for everything that is still in progress. My first table is the sample data. The second table is what the running total should be without slicing any date. The third table is looking at everything after 5/1/2018. 

     

    I am slicing the date using the Finish Date. When I adjust my slicer to the specific date of 5/1/2018 all the projects that were completed before 5/1/2018 should no longer be added to the running total (The third table).  

     

    As mentioned earlier all the posts I have read keep giving the same formula as 

    Running Total =
    CALCULATE (
    SUM ( Table[column] ),
    FILTER ( ALL ( Table ), Table[columnDate] <= MAX ( Table[ColumnDate] ) )
    )

     

    However, this is not giving me my needed outcome. Any advice you can give will be much appreciated! Thank you!

    • v-juanli-msft's avatar
      v-juanli-msft
      Icon for Community Support rankCommunity Support

      Hi Anonymous

      create a new table with fomula below, then create a measure in that table, next edit relationship between this new table and your original data table, finally add the column "Finish Date" from this new table to the slicer.

      Table = VALUES(Table1[Finish Date])
      
      selected = SELECTEDVALUE('Table'[Finish Date])

       

      Then create a measure in your data table

      Measure =
      CALCULATE (
          SUM ( Table1[Words] ),
          FILTER (
              ALLEXCEPT ( Table1, Table1[Person] ),
              [Finish Date] <= MAX ( Table1[Finish Date] )
                  && [Finish Date] >= [selected]
          )
      )

       

       

      Best Regards

      maggie