Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi, I am trying to get the Year on Year variance using DAX.
I am new to DAX and have been searching for a solution however, I haven't be able to solve this problem.
Below is the DAX I am using now, as you can see I am using date from a calendar table. and I am trying to get the yoy variance (instead of the YOY percentage I get in the query below) of the variable 'waterfall_TEMP All'[Rate_SalaryWages]'
I am wondering how I should change the DAX. Thank you very much for helping in advance
Solved! Go to Solution.
@Anonymous , How that formula is different?
YOY = divide([Current]-[Last], [Last])
or
YOY = divide([Current], [Last])
example for YTD
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD("Date"[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd("Date"[Date],-1,Year),"12/31"))
or
This Year = CALCULATE(sum("order"[Qty]),filter(ALL("Date"),"Date"[Year]=max("Date"[Year])))
Last Year = CALCULATE(sum("order"[Qty]),filter(ALL("Date"),"Date"[Year]=max("Date"[Year])-1))
diff = [This Year]-[Last Year ]
diff % = divide([This Year]-[Last Year ],[Last Year ])
Make sure Calendar is marked as date table
@amitchandak Hi
I am only trying to get the YOY variance,
meaning getting the part where this year's YTD minus Last Year's YTD.
so I think it should be : diff = [This Year]-[Last Year ]
I am trying to make sure I get the right data, the data of each year's YOY.
Do you have any suggestion on how I can check that?
Thanks a lot
@Anonymous , How that formula is different?
YOY = divide([Current]-[Last], [Last])
or
YOY = divide([Current], [Last])
example for YTD
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD("Date"[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd("Date"[Date],-1,Year),"12/31"))
or
This Year = CALCULATE(sum("order"[Qty]),filter(ALL("Date"),"Date"[Year]=max("Date"[Year])))
Last Year = CALCULATE(sum("order"[Qty]),filter(ALL("Date"),"Date"[Year]=max("Date"[Year])-1))
diff = [This Year]-[Last Year ]
diff % = divide([This Year]-[Last Year ],[Last Year ])
Make sure Calendar is marked as date table
User | Count |
---|---|
25 | |
12 | |
8 | |
6 | |
6 |
User | Count |
---|---|
26 | |
12 | |
12 | |
10 | |
6 |