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
larsvedoy
Frequent Visitor

Create running cost column with two filters

I'm trying to make a calculated column for running cost that sums the value in a cost column. My table has to columns that need to match; one column with a  branch number and one colomn with periods. It is the last column in the screen shot from Excel under I am trying to recreate in PowerBI.

 

Skjermbilde01.PNG

 

Greateful for any help,

 

Lars

 

 

1 ACCEPTED SOLUTION

so its good that a single branch ID is for the whole year and that your period field is a true date field type....  this is air code and I named your table: SampleData ..so you'll want to replace that

 

Running Cost =

CALCULATE (

  SUM ( SampleData[Cost] ),

  ALLEXCEPT ( SampleData, SampleData[Branch] ),

  SampleData[Period] <= EARLIER ( SampleData[Period] )

                     )

www.CahabaData.com

View solution in original post

5 REPLIES 5
CahabaData
Memorable Member
Memorable Member

You will want to be sure your Period field is set to actually be a Date field type and not text.

 

But the big challenge is that I see the running total is reset on Jan 17 regardless of the branch IDs.  This is problematic since Jan 17 is repeating and so one needs another unique ID to refer to.

 

Is there an element of the Branch IDs that is unique to each year data set - I notice the first set is 2xxxxx and second set is 3xxxxxx - is this true throughout such that 2 and 3 don't repeat again?

 

 

www.CahabaData.com

Thanks,

 

The date field is formated as a date field (sorry for the Norwegian standard). Jan 17 means January 2017.

 

There are 150 different branches, where the majority starts with 2. I see in my mock up data set the branch number starting with 3 changes - they are meant to be the same - so that there are only two different branches in this data set.

 

Lars

so its good that a single branch ID is for the whole year and that your period field is a true date field type....  this is air code and I named your table: SampleData ..so you'll want to replace that

 

Running Cost =

CALCULATE (

  SUM ( SampleData[Cost] ),

  ALLEXCEPT ( SampleData, SampleData[Branch] ),

  SampleData[Period] <= EARLIER ( SampleData[Period] )

                     )

www.CahabaData.com

Thanks, that solved it. I've tried different versions of the same, but didn't seem to get it right.

 

Lars

I understand Norway has one of the biggest and most active PBI User Groups - you'll want to check them out - they are listed elsewhere in the Groups area of this site.

www.CahabaData.com

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.