Forum Discussion
Poloscopie
1 year agoFrequent Visitor
Issue with quantity difference between two dates when sorting by date descending
Hello dear PBI community, I have an issue with a metric on a report, which calculates the difference of a quantity between two snapshots. This issue occurs when I change the way the snapshots are...
- 1 year ago
I missed the wrong PREVIOUSDAY reference
Sahir_Maharaj
1 year agoSuper User
Hello Poloscopie,
Can you please try this approach:
Qty Δ D-1 =
VAR CurrentDate = MAX('Evolution of Qty'[Photo])
VAR PreviousDate =
CALCULATE(
MAX('Evolution of Qty'[Photo]),
'Evolution of Qty'[Photo] < CurrentDate
)
VAR PreviousQty =
CALCULATE(
SUM('Evolution of Qty'[Qty]),
'Evolution of Qty'[Photo] = PreviousDate
)
RETURN
IF(
ISBLANK(PreviousDate),
BLANK(),
SUM('Evolution of Qty'[Qty]) - PreviousQty
)
- Poloscopie1 year agoFrequent Visitor
Unfortunately, this gives the same result.
I named your function "Qty Δ Test".
When dates are sorted the ascending way, it's ok:
When sorted the other way, your function returns blank: