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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
moshea4
New Member

Cumulative.......break down shift cumulative to hourly values

Hi

My Oracle database is giving me the cumulative value for the production from a production line, I want to calculate the hourly values as I have done in the column "Hourly Values (I HAVE CALCULATED)" in excel

Each Shift ID has 12 hours and the value is the cumulative shift total, so hour 1 actual production should be the value given 16980 and hour 2 should be Hour 2 value - hour 1 value 31700-16980=14720

How to do this in powerBi

 

LINE_DESCRSHIFT_IDSHIFT_HOURVALUEHourly Values (I HAVE CALCULATED)
Line 401257211698016980
Line 401257223170014720
Line 401257234453012830
Line 401257246032015790
Line 401257257678016460
Line 401257268903012250
Line 40125727977208690
Line 401257281052107490
Line 4012572911965014440
Line 40125721013646016810
Line 40125721115376017300
Line 40125721217003016270
Line 401257311728017280
Line 401257323454017260
Line 401257335022015680
Line 401257346566015440
Line 401257358216016500
Line 401257369890016740
Line 4012573711493016030
Line 4012573813104016110
Line 4012573914880017760
Line 40125731016431015510
Line 40125731118213017820
Line 40125731219951017380
Line 401257411676016760
Line 401257423330016540
Line 401257434766014360
Line 401257446451016850
Line 401257457824013730

 

1 ACCEPTED SOLUTION

Yes...I just had to add in a filter on Tag Name also. Thank you.

View solution in original post

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

See my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395...

 

Also, https://community.powerbi.com/t5/Quick-Measures-Gallery/Periodic-Revenue-Reverse-YTD/m-p/373185#M111

 

I would go with the first one, just grab your current shift, subtract one, look that value up accounting for Shift Id, should be fairly simple.

Column =
  VAR __CurrentShift = [SHIFT_HOUR]
  VAR __CurrentValue = [VALUE]
  VAR __PreviousValue = 
    MAXX(
      FILTER(
        'Table',
        [LINE_DESCR] = EARLIER([LINE_DESCR]) &&
          [SHIFT_ID] = EARLIER([SHIFT_ID]) &&
            [SHIFT_HOUR] = __CurrentShift - 1
      ),
      [VALUE]
     )
RETURN
  __CurrentValue - __PreviousValue


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Yes...I just had to add in a filter on Tag Name also. Thank you.

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.