Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hi!
So I'm trying to "move" alla previous year metrics one day. For example; 2022-11-18 should be compared to 2021-11-19. I have solved it on a line by line basis but the sum of days doesn't work. I realize that it must be down to my "max"-part of the calculation but can't figure out an alternative to work.
See below example, the total takes the latest date.
Formula looks like this:
Any ideas?
Solved! Go to Solution.
Ok, try this then:
PY =
SUMX (
VALUES ( Table[Date] ),
CALCULATE (
[Sales],
FILTER (
ALL ( 'Date'[Date] ),
'Date'[Date]
= MAX ( OrderData[OrderDate] ) - 364
)
)
)
Proud to be a Super User!
Paul on Linkedin.
Try:
PY with total =
SUMX(VALUES(Table[Date]), [PY Sales])
Proud to be a Super User!
Paul on Linkedin.
Hi! The solution works, but its' not ideal because then I need to create 2 metrics for all PY calculations.
In other words, ideally I would just have 1 metric for PY rather than having to create first the "YTD"* PY calculation and then the sum calculation of that.
*YTD = Max date being last orderdate
Ok, try this then:
PY =
SUMX (
VALUES ( Table[Date] ),
CALCULATE (
[Sales],
FILTER (
ALL ( 'Date'[Date] ),
'Date'[Date]
= MAX ( OrderData[OrderDate] ) - 364
)
)
)
Proud to be a Super User!
Paul on Linkedin.
User | Count |
---|---|
121 | |
69 | |
66 | |
56 | |
52 |
User | Count |
---|---|
182 | |
85 | |
67 | |
61 | |
53 |