Forum Discussion
Theo_Alex
2 years agoRegular Visitor
Difference between two entries
Hi ya’ll, I have a problem regarding my data model and its calculation. I have a data model which is organized in rows. Quite similar to an OLAP/Cube. Each User and Entry gets an ID. Also eac...
- 2 years ago
Hi Theo_Alex ,
You can try below measure.
Last Entry = CALCULATE( SUM('Table'[Score]), OFFSET( -1, ALL('Table'[User_ID],'Table'[Score_ID],'Table'[Entry_ID],'Table'[Entry_Date]), ORDERBY('Table'[Entry_Date],ASC), PARTITIONBY('Table'[User_ID],'Table'[Score_ID]) ) )Demo - 5-31calculate Difference between two entries.pbix
Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !
Thank you~
xifeng_L
2 years agoSuper User
Hi Theo_Alex ,
You can try below measure.
Last Entry =
CALCULATE(
SUM('Table'[Score]),
OFFSET(
-1,
ALL('Table'[User_ID],'Table'[Score_ID],'Table'[Entry_ID],'Table'[Entry_Date]),
ORDERBY('Table'[Entry_Date],ASC),
PARTITIONBY('Table'[User_ID],'Table'[Score_ID])
)
)
Demo - 5-31calculate Difference between two entries.pbix
Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !
Thank you~
Theo_Alex
2 years agoRegular Visitor
It worked out! I Had to change the format of the date in the database before I load it into my model but since I changed the format so PBI could recognize it as date I could calculate the differences between all entries per User, per Score, per Entry. And the first Entry has of course no data. Nice Thanks!!