Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have data as per below
Month | Data |
Jan | 20 |
Feb | 10 |
Mar | 30 |
Apr | 50 |
May | 60 |
Jun | 70 |
Jul | 80 |
Aug | 90 |
Sept | 10 |
Oct | 20 |
Nov | 30 |
Dec | 40 |
If user selects Feb then it will show Jan+Feb/2
If user selects Mar,Apr,May then it will show Feb+May/2
Can you please suggest.
Thanks
Either convert your Month field to be a dual field in the script using this:
LOAD Month(Date#(Month, 'MMM')) as Month
or try this expression:
=Sum({<Month={"$(=Pick(MinString(Month(Date#(Month, 'MMM'))-1), 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'))","$(=MaxString(Date#(Month, 'MMM')))"}>} Data) /2
Selecting a single month will probably break the calculation. You can fix this by splitting the min/max month sum into two sums. In pseudo-expression code:
=(Sum({set spec for min selected month} Data) + Sum({set spec for max selected month} Data)) /2
Peter