Quantcast
Channel: Latest Questions by aRookieBIdev
Viewing all articles
Browse latest Browse all 76

SQL Query Logic

$
0
0
My Table data is like ![alt text][1] My expected result is ![alt text][2] My Numerator is calculated on the following logic For Duration 0 : Sum of all values For Duration non 0 :Sum of all Values except for the first Row of the Duration My Denominator is calculated on the following logic For Duration 0 : Sum of all values For Duration non 0 :Sum of all Values except for the last Row of the Previous Duration Please guide me with this approach.I am quite stuck here . Sorry but to add to this , I also need Ratio and Cumulative Ratio as below ![alt text][3] My Ratio is a fraction of numerator/denominator for each duration where as my cumulative ratio is (Ratio * Cumulative Ratio of the previous duration) *The first cumulative ratio is 100 Kannan Kannan [1]: /storage/temp/1441-table.png [2]: /storage/temp/1442-result.png [3]: /storage/temp/1446-final.png

Viewing all articles
Browse latest Browse all 76

Trending Articles