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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Cumulative Costs with Multiple Filters

Hello,

 

I'm trying to create a new column in Power Query that will show cumulative costs and take multiple filters into consideration. I created a mockup table to explain it better. I'm trying to create the total costs column. 

 
 
 
 

Screenshot 2020-11-26 095816.png

The idea is simple, if campaign end year is "ongoing" and campaign type is "online" then it should cumulatively sum estimated costs. See campaign year 2018 for example, it sums Campaign 1 from 2017 (both ongoing and online 25.000) and Campaign 3 from 2018 (6.500).  Because at the beginning of 2018, we have only these two costs. Whereas in 2020, it's the sum of Campaign 1 and Campaign 4 (both ongoing and online) and the 5th campaign. It should also automatically fill when there are no campaigns in one year (due to the ongoing and online campaigns from previous years).

 

I tried to achieve it with =SUMX and IF but because Campaign End Year is not a date type (for obvious reasons), it doesn't work.

 

Any ideas appreciated,

 

Thanks

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Anonymous 

Try this create the following column: 

 

Column = CALCULATE(SUM('Table'[Estimated Cost]),FILTER('Table',[Start Year]<=EARLIER('Table'[Start Year])&&[Compaign End Year]="Ongoing" && [Campaign Type]="Online"))

 

running total filter.JPG


Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

@Anonymous 

Try this create the following column: 

 

Column = CALCULATE(SUM('Table'[Estimated Cost]),FILTER('Table',[Start Year]<=EARLIER('Table'[Start Year])&&[Compaign End Year]="Ongoing" && [Campaign Type]="Online"))

 

running total filter.JPG


Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

@Anonymous 

 

Is there some mistake in the description? Where you said "if campaign end year is "ongoing" and campaign type is "in person"", but there is only 1 row(Campain 2) matches this condition. Can you clarify, we cannot create formula without correct logic. 

 

Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Thanks @Anonymous for catching this. You are right! It should've been "ongoing" and "online". I also realized my mock-up data doesn't provide the results that I need. In my case, there are no campaigns in 2018, whereas there is cost associated to that year because of 2017 ongoing & online campaign (Campaign 1), I'll edit the original question. 

 

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors