0

Need help in querying the below logic:

I have to calculate renewals. An org can order up to 5 licenses in total from us

License Table 2018

Year Licenses
2018 A
2018 A
2018 B
2018 B
2018 C
2019 A
2019 A
2019 B

License Table 2019:

Year Licenses
2019 A
2019 A
2019 B

Result:

License Renewal Percentage
A 100%
B 50%
C 0%

More conditions:

Suppose the 2 order dates are 6/30/2019 and 7/1/2020, which are in FY19 and FY21 respectively. Even though the 2nd order is barely more than 1 year later, it is not treated as a renewal.

  • 4
    Sample data and the desired output would help. – Serg May 07 '21 at 08:02
  • Thanks for the feedback, just added the sample input and result. Would really appreciate your help. – Stan Smith May 10 '21 at 06:56
  • `Licenses Renewed` doen't look as a table really. Could you share the table structure? – Serg May 10 '21 at 07:07
  • Its not really a table like I presented, but its the same table like the first table, with two licenses for A and one license for B. I just added a more concise structure of the same first table. But I have made the edits for your better understanding. Thanks – Stan Smith May 10 '21 at 15:20

0 Answers0