Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Calculating Difference Current v. Prior Year

We need to calculate and use in a line graph the difference, based on ID, of the prior year v. current year.


So far, we have 2 years but this will need to work generally.  Naturally the first year 2015 would have no "difference" record.  The subsequent years would.


  

IDYearRatio
100163820163.57
100163820154.18
100334620150.25
100334620162.19
100375020150.49
100375020160.50
100376420153.07
100376420164.07
100376720162.11
100376720152.26

We are calculating the ratio, currently, as a measure.


Is this all best done in the load script, or as a calculated measure?

2 Replies
Anil_Babu_Samineni

Let's consider one row

ID Year Ratio
1001638 2016 3.57

Can you explain 3.57??

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
nitin_01
Creator
Creator

Hi David,

        As per my understanding, from your query.

Create two variable :- vMax=Max(Year)  & vPrev=$(vMax)-1

Put vMax into you first expression and vPrev in second expression with your needed measure, that would give you two lines in chart where you can see the difference in current & Previous year.

Current Vs Prev.PNG

Regards,

Nitin G.