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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Jbell314
Regular Visitor

How to get regular value given cumulative?

Basically I'm given a running cumulative total (I'll show example below) and i need to have the individual values figured out

 

Here's how data look:

Week end date (date format)Cumulative Hours**Individual hours (what is needed to calculated i just inputed what its supposed to be obviously but isn't given to me)
1/10/202111
1/17/202165
1/24/202182
1/31/2021102

I know the formula would just be like ((1/17/2021) - (1/10/2021) =  hrs for 1/17/2021 but i don't know what formulas to use to select the individual rows)

 

**The 3rd column is not given and needs to be calculated in powerbi (something that is super easy in excel but i have found difficult in powerbi lol)

 

Much appreciated

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Jbell314 ,

 

You have 3 different ways to achieve this:

  1. Power Query
  2. Calculated Column
  3. Measure

 

 

  1. Power Query:
  2.  
  • Add an index column
  • Add a calculated colum with the following syntax:
if [Index] = 0 then [Cumulative] else 
[Cumulative] - 
 #"Added Index"[Cumulative]{[Index] -1}

 

The #"Added Index" part must have the name of the previous step before adding the custom column

MFelix_0-1631555168760.png

 

      2. Calculated Column

 

Individual Hours Calculated column =
Hours[Cumulative]
    - CALCULATE (
        SUM ( Hours[Cumulative] ),
        FILTER ( ALL ( Hours ), Hours[Index] = EARLIER ( Hours[Index] ) - 1 )
    )

MFelix_1-1631555427575.png

 

     3. Measure

Individual Hours measure =
SUM ( Hours[Cumulative] )
    - CALCULATE (
        SUM ( Hours[Cumulative] ),
        FILTER ( ALL ( Hours ), Hours[Index] = SELECTEDVALUE ( Hours[Index] ) - 1 )
    )

MFelix_2-1631555649014.png

 

PBIX file attach.

 

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português





View solution in original post

1 REPLY 1
MFelix
Super User
Super User

Hi @Jbell314 ,

 

You have 3 different ways to achieve this:

  1. Power Query
  2. Calculated Column
  3. Measure

 

 

  1. Power Query:
  2.  
  • Add an index column
  • Add a calculated colum with the following syntax:
if [Index] = 0 then [Cumulative] else 
[Cumulative] - 
 #"Added Index"[Cumulative]{[Index] -1}

 

The #"Added Index" part must have the name of the previous step before adding the custom column

MFelix_0-1631555168760.png

 

      2. Calculated Column

 

Individual Hours Calculated column =
Hours[Cumulative]
    - CALCULATE (
        SUM ( Hours[Cumulative] ),
        FILTER ( ALL ( Hours ), Hours[Index] = EARLIER ( Hours[Index] ) - 1 )
    )

MFelix_1-1631555427575.png

 

     3. Measure

Individual Hours measure =
SUM ( Hours[Cumulative] )
    - CALCULATE (
        SUM ( Hours[Cumulative] ),
        FILTER ( ALL ( Hours ), Hours[Index] = SELECTEDVALUE ( Hours[Index] ) - 1 )
    )

MFelix_2-1631555649014.png

 

PBIX file attach.

 

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português





Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.