Forum Discussion
vkasula01
6 years agoNew Member
DAX for deltas
Hi, I am trying to show trend line with data for about a two years. i have created year slicers for the last three years. So when I click the slicer for the current year the data seems to right a...
Anonymous
6 years agoNot applicable
What I can think is to create a slicer table for 2019 and 2020, then filter the trend measures to be displayed in the chart. Please see the attatched sample pbix, I used random values just to show the idea.
Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
vkasula01
6 years agoNew Member
The measure which i create is working fine. when i select single year delta(up or down arrow) are working fine.
But when I select trend line for multipul years if the user clicks on any of the data point in one of the trend line it sums up the value for that particular week for all the year give the delta based on the sum we get for particular week.
Measure used for creating line graph:
surcharge2019 = CALCULATE(SUM(Summary[surcharge]),FILTER(Summary,YEAR(Summary[Date]) = 2019))
surcharge2020 = CALCULATE(SUM(Summary[Rsurcharge]),FILTER(Summary,YEAR(Summary[Date]) = 2020))
Measure used for creating delta(Up or down arrow):
1) 2_Down = IF(HASONEVALUE(Summary[WeekNum]) && Sum(Summary[surcharge])> SUM(Summary[Column surcharge]),UNICHAR(9650),"")
2) 2_UP = IF(HASONEVALUE(Summary[WeekNum]) && Sum(Summary[ surcharge])< SUM(Summary[Column surcharge]),UNICHAR(9660),"")
3) Opt_RatioG = var A=CALCULATE(SUM(Summary[surcharge]), FILTER(Summary,MAX(Summary[WeekNum]) = Summary[WeekNum]))*100 VAR B = CALCULATE(SUM(Summary[Column surcharge]), FILTER(Summary,MAX(Summary[WeekNum]) = Summary[WeekNum])) *100 Return(IF(HASONEVALUE(Summary[WeekNum]) = FALSE() && A< B, UNICHAR(9660),""))
4) Opt_RatioR = var A=CALCULATE(SUM(Summary[surcharge]), FILTER(Summary,MAX(Summary[WeekNum]) = Summary[WeekNum]))*100
VAR B = CALCULATE(SUM(Summary[Column surcharge]), FILTER(Summary,MAX(Summary[WeekNum]) = Summary[WeekNum])) *100 Return(IF(HASONEVALUE(Summary[WeekNum]) = FALSE() && A> B, UNICHAR(9650),""))
The requiment is when a user clicks on one of the data point the delts should be crearted based on the particular weeky number for the seleted line(seleted year).