Forum Discussion
Finding the value difference between dates
- 3 years ago
maybe Johnt75 forgot to -1 for CurrentDate. like:
Diff to prev day =
VAR CurrentDate = 'Table'[Date]
VAR CurrentUnit = 'Table'[Unit]
VAR CurrentValue = 'Table'[Parameter]
VAR PrevValue =
LOOKUPVALUE (
'Table'[Parameter],
'Table'[Date], CurrentDate-1,
'Table'[Unit], CurrentUnit,
0
)
RETURN
CurrentValue - PrevValue
You could add a column like
Diff to prev day =
VAR CurrentDate = 'Table'[Date]
VAR CurrentUnit = 'Table'[Unit]
VAR CurrentValue = 'Table'[Parameter]
VAR PrevValue =
LOOKUPVALUE (
'Table'[Parameter],
'Table'[Date], CurrentDate,
'Table'[Unit], CurrentUnit,
0
)
RETURN
CurrentValue - PrevValue
maybe Johnt75 forgot to -1 for CurrentDate. like:
Diff to prev day =
VAR CurrentDate = 'Table'[Date]
VAR CurrentUnit = 'Table'[Unit]
VAR CurrentValue = 'Table'[Parameter]
VAR PrevValue =
LOOKUPVALUE (
'Table'[Parameter],
'Table'[Date], CurrentDate-1,
'Table'[Unit], CurrentUnit,
0
)
RETURN
CurrentValue - PrevValue
- FreemanZ3 years agoSuper User
hi Anonymous
something like this shall also work, right?
Diff to prev day =VAR CurrentDate = 'Table'[Date]VAR CurrentUnit = 'Table'[Unit]VAR CurrentValue = 'Table'[Parameter]VAR PrevValue =MINX (FILTER('Table','Table'[Unit]=CurrentUnit&&'Table'[Date]=CurrentDate-1),'Table'[Parameter]RETURNCurrentValue - PrevValue- Anonymous3 years agoNot applicable
Since I am new to Power BI I can't tell if this should work or not, but when I tried it for my model it didn't 😞