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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
sTiTcH
Frequent Visitor

Counter comparison between previous values

 have a table of data with the structure below. The table is called 'machines'. The absoluteCount column keeps a tally of the count at the time of the dateTime column. I am trying to figure out how to create a new column with the increase in the count between the current absoluteCount value and the previous absoluteCount value by machineID. There are approximately 50 different machines that are tracked in this table. 

 

With the times being down to the minute, I haven't come up with a good way to do this. Any help or directions would be appreciated.

 

Thanks

 

 

 

dateTimemachineIDabsoluteCount
8/20/2017 0:00machine021146051
8/20/2017 0:00machine01443168
8/20/2017 1:00machine021146051
8/20/2017 1:00machine01443168
8/20/2017 2:00machine021146051
8/20/2017 2:00machine01443168
8/20/2017 3:00machine021146051
8/20/2017 3:00machine01443168
8/20/2017 4:00machine021146051
8/20/2017 4:00machine01443168
8/20/2017 5:00machine021146051
8/20/2017 5:00machine01443168
8/20/2017 6:00machine021146051
8/20/2017 6:00machine01443168
8/20/2017 7:00machine021146051
8/20/2017 7:00machine01443168
8/20/2017 8:00machine021146051
8/20/2017 8:00machine01443168
8/20/2017 9:00machine021146051
8/20/2017 9:00machine01443168
8/20/2017 10:00machine021146051
8/20/2017 10:00machine01443168
8/20/2017 11:00machine021146051
8/20/2017 11:00machine01443168
8/20/2017 12:00machine021146051
8/20/2017 12:00machine01443168
8/20/2017 13:00machine021146051
8/20/2017 13:00machine01443168
8/20/2017 14:00machine021146051
8/20/2017 14:00machine01443168
8/20/2017 15:00machine021146051
8/20/2017 15:00machine01443168
8/20/2017 16:00machine021146051
8/20/2017 16:00machine01443168
8/20/2017 17:00machine021146051
8/20/2017 17:00machine01443168
8/20/2017 18:00machine021146051
8/20/2017 18:00machine01443168
8/20/2017 19:00machine021146051
8/20/2017 19:00machine01443168
8/20/2017 20:00machine021146051
8/20/2017 20:00machine01443168
8/20/2017 21:00machine021146051
8/20/2017 21:00machine01443168
8/20/2017 22:00machine021146051
8/20/2017 22:00machine01443168
8/20/2017 23:00machine021146051
8/20/2017 23:00machine01443168
8/21/2017 0:00machine021146051
8/21/2017 0:00machine01443168
8/21/2017 1:00machine021146051
8/21/2017 1:00machine01443168
8/21/2017 2:00machine021146051
8/21/2017 2:00machine01443168
8/21/2017 3:00machine021146051
8/21/2017 3:00machine01443168
8/21/2017 4:00machine021146051
8/21/2017 4:00machine01443168
8/21/2017 5:00machine021146051
8/21/2017 5:00machine01443168
8/21/2017 6:00machine021146051
8/21/2017 6:00machine01443168
8/21/2017 7:00machine021146057
8/21/2017 7:00machine01443168
8/21/2017 8:00machine021147775
8/21/2017 8:00machine01443168
8/21/2017 9:00machine021150152
8/21/2017 9:00machine01443168
8/21/2017 10:00machine021151552
8/21/2017 10:00machine01443168
8/21/2017 11:00machine021154099
8/21/2017 11:00machine01443168
8/21/2017 12:00machine021156869
8/21/2017 12:00machine01443168
8/21/2017 13:00machine021158234
8/21/2017 13:00machine01443168
8/21/2017 14:00machine021160631
8/21/2017 14:00machine01443168
8/21/2017 15:00machine021160631
8/21/2017 15:00machine01443168
8/21/2017 16:00machine021160631
8/21/2017 16:00machine01443168
8/21/2017 17:00machine021160631
8/21/2017 17:00machine01443168
8/21/2017 18:00machine021160631
8/21/2017 18:00machine01443168
8/21/2017 19:00machine021160631
8/21/2017 19:00machine01443168
8/21/2017 20:00machine021160631
8/21/2017 20:00machine01443168
8/21/2017 21:00machine021160631
8/21/2017 21:00machine01443168
8/21/2017 22:00machine021160631
8/21/2017 22:00machine01443168
8/21/2017 23:00machine021160631
8/21/2017 23:00machine01443168
8/22/2017 0:00machine021160631
8/22/2017 0:00machine01443168
8/22/2017 1:00machine021160631
8/22/2017 1:00machine01443168
8/22/2017 2:00machine021160631
8/22/2017 2:00machine01443168
8/22/2017 3:00machine021160631
8/22/2017 3:00machine01443168
8/22/2017 4:00machine021160631
8/22/2017 4:00machine01443168
8/22/2017 5:00machine021160631
8/22/2017 5:00machine01443168
8/22/2017 6:00machine021160631
8/22/2017 6:00machine01443168
8/22/2017 7:00machine021160637
8/22/2017 7:00machine01443168
8/22/2017 8:00machine021161689
8/22/2017 8:00machine01443168
8/22/2017 9:05machine021164295
8/22/2017 9:05machine01443168
8/22/2017 10:00machine021164878
8/22/2017 10:00machine01443168
8/22/2017 11:00machine021167029
8/22/2017 11:00machine01443168
8/22/2017 12:00machine021169544
8/22/2017 12:00machine01443168
8/22/2017 13:00machine021170464
8/22/2017 13:00machine01443168
8/22/2017 14:00machine021173607
8/22/2017 14:00machine01443168
8/22/2017 15:00machine021175815
8/22/2017 15:00machine01443168
8/22/2017 16:00machine021176001
8/22/2017 16:00machine01443168
8/22/2017 17:00machine021176001
8/22/2017 17:00machine01443168
8/22/2017 18:00machine021176001
8/22/2017 18:00machine01443168
8/22/2017 19:00machine021176001
8/22/2017 19:00machine01443168
8/22/2017 20:00machine021176001
8/22/2017 20:00machine01443168
8/22/2017 21:00machine021176001
8/22/2017 21:00machine01443168
8/22/2017 22:00machine021176001
8/22/2017 22:00machine01443168
8/22/2017 23:00machine021176001
8/22/2017 23:00machine01443168
8/23/2017 0:00machine021176001
8/23/2017 0:00machine01443168
8/23/2017 1:00machine021176001
8/23/2017 1:00machine01443168
8/23/2017 2:00machine021176001
8/23/2017 2:00machine01443168
8/23/2017 3:00machine021176001
8/23/2017 3:00machine01443168
8/23/2017 4:00machine021176001
8/23/2017 4:00machine01443168
8/23/2017 5:00machine021176001
8/23/2017 5:00machine01443168
8/23/2017 6:00machine021176001
8/23/2017 6:00machine01443168
8/23/2017 7:00machine021176007
8/23/2017 7:00machine01443168
8/23/2017 8:01machine021177981
8/23/2017 8:01machine01443168
8/23/2017 9:00machine021180157
8/23/2017 9:00machine01443168
8/23/2017 10:00machine021181738
8/23/2017 10:00machine01449335
8/23/2017 11:00machine021184519
8/23/2017 11:00machine01449335
8/23/2017 12:00machine021186987
8/23/2017 12:00machine01457458

 

 

1 ACCEPTED SOLUTION
sTiTcH
Frequent Visitor

I figred it out with help from other threads.

 

Created a Rank column to index each machineID by date, otherwise it would index the whole table regardless of machineID:

 

Rank =
VAR machineID = table[machineID]
RETURN
RANKX(
FILTER(
ALL(
table),table[machineID]=machineID), table[dateTime],,ASC)

 

 

Get Previous Day Value using the created Rank:

 

PreviousRowValue =
VAR Index = table[Rank] - 1
Return
CALCULATE(
MAX(table[absoluteCount]),
FILTER(ALLEXCEPT(table,table[machineID]),table[Rank] = Index))

 

View solution in original post

1 REPLY 1
sTiTcH
Frequent Visitor

I figred it out with help from other threads.

 

Created a Rank column to index each machineID by date, otherwise it would index the whole table regardless of machineID:

 

Rank =
VAR machineID = table[machineID]
RETURN
RANKX(
FILTER(
ALL(
table),table[machineID]=machineID), table[dateTime],,ASC)

 

 

Get Previous Day Value using the created Rank:

 

PreviousRowValue =
VAR Index = table[Rank] - 1
Return
CALCULATE(
MAX(table[absoluteCount]),
FILTER(ALLEXCEPT(table,table[machineID]),table[Rank] = Index))

 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

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.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.