Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Running total modification

Hi PowerBI community,


First off, I hope you are all well and safe in these challenging times.

 

I was hoping some of you might be able to assist me with a working "running total" formula that I need to amend for two specific scenarios:

 

  • My running total agreggates "actuaL" (vs forecast) numbers and I am hoping to hide the value for future months. I have tried different ways to adjust my measure but to no avail.

 

 

DI Impact Actual Running Total = CALCULATE(
                  SUM ('DI Impact'[DI Impact]),
                  FILTER (
                    ALL ('DI Impact'),'DI Impact'[DI Impact Date] <= MAX ('DI Impact'[DI Impact Date])
                  ),'DI Impact'[DI Impact Type]="Actual"
)

 

 

  • I have another running total measure which reads against a table where unfortunately the monthly values are repeated and I would like to only agreggate the first value of each month. Below is a table of the structure of my data
31 Jan 202020
29 Feb 202020
31 Jan 202020
30 Apr 202020
30 Mar 202020

 

I would effectively like my meeasure to return the following when visualized against the DI Impact Date column:

 

31 Jan 202020
29 Feb 202040
30 Mar 202060
31 Apr 202080

 

ANd here is my formula:

 

 

DI Target Running = CALCULATE(
                  SUM ('DI Impact'[DI Target.DI Target Amount]),
                  FILTER (
                    ALL ('DI Impact'),'DI Impact'[DI Impact Date] <= MAX ('DI Impact'[DI Impact Date])
                  )
)

 

 

 

Thanks in advance for any suggestion you can provide!

OF

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi all,

 

Unfortunately none of these solutions worked 😞 What I ended-up doing:

 

  • future month as blank: I gave up
  • only suming the first line against a repetitive month: I moved the columns in a separate column with no repeats and applied a simple running total measure and created a relationship back to the first table.

THanks all for trying to help 🙂

OF

View solution in original post

8 REPLIES 8
amitchandak
Super User
Super User

@Anonymous , try the first formula. Or try the second one with a date calendar

DI Impact Actual Running Total = CALCULATE(
                  SUM ('DI Impact'[DI Impact]),
                  FILTER (
                    ALL ('DI Impact'),'DI Impact'[DI Impact Date] <= MAX ('DI Impact'[DI Impact Date])
                  && 'DI Impact'[DI Impact Type]="Actual"
)
)


Or 

DI Impact Actual Running Total = CALCULATE(
                  SUM ('DI Impact'[DI Impact]),
                  FILTER (
                    ALL ('Date'),'Date'[Date] <= MAX ('DI Impact'[Date]))
                  ,'DI Impact'[DI Impact Type]="Actual"

)
Anonymous
Not applicable

@amitchandak , thank you for the suggestion. You actually gave me the idea to further amend the formula to be more precise. 

 

Unfortunately it still shows numbers for months in the future whereas I was hoping to show "null"

Try for the future month as 0

DI Impact Actual Running Total = CALCULATE(
                  SUM ('DI Impact'[DI Impact]),
                  FILTER (
                    ALL ('DI Impact'),'DI Impact'[DI Impact Date] <= MAX ('DI Impact'[DI Impact Date])
					&& 'DI Impact'[DI Impact Date] <=today()
                  && 'DI Impact'[DI Impact Type]="Actual"
)
)


Or 

DI Impact Actual Running Total = CALCULATE(
                  SUM ('DI Impact'[DI Impact]),
                  FILTER (
                    ALL ('Date'),'Date'[Date] <= MAX ('DI Impact'[Date])
					&& 'Date'[Date]<=today()
					)
                  ,'DI Impact'[DI Impact Type]="Actual"

)
Anonymous
Not applicable

Hi all,

 

Unfortunately none of these solutions worked 😞 What I ended-up doing:

 

  • future month as blank: I gave up
  • only suming the first line against a repetitive month: I moved the columns in a separate column with no repeats and applied a simple running total measure and created a relationship back to the first table.

THanks all for trying to help 🙂

OF

Hi @Anonymous ,

 

You can try this code to calculate running total without group the values before:

 

CALCULATE(SUMX(Table_2; Table_2[Value] / CALCULATE(COUNT(Table_2[Date]))); FILTER(ALL(Table_2[Date]); Table_2[Date] <= MAX(Table_2[Date])))
 
I hope it helps,
 
Ricardo


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Anonymous
Not applicable

Hi @camargos88 , do you suggest I use this formula for my first or second problem? I'm trying to convert it to make it work 🤔

Hi @Anonymous ,

 

The second one, this formula handles the duplicated value.

 

Ricardo



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Anonymous
Not applicable

Unfortunately it still sums everything up for the same month, although only for previous months, not future. Did I do something wrong:

 

 

DI Target Running (test) = CALCULATE(
                  SUMX('DI Impact','DI Impact'[DI Target.DI Target Amount] / CALCULATE(COUNT('DI Impact'[DI Impact Date]))),
                  FILTER(ALL('DI Impact'[DI Impact Date]),'DI Impact'[DI Impact Date] <= MAX('DI Impact'[DI Impact Date])))

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.