Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
vijetas42
Specialist
Specialist

Calculating Values

Hi all,

I am having requirement as, my data is

   Month, Start, End
     01, 130, 100
     02, 110, 120

     03, 100, 100
     04,90,100
     05,100,110
     06,100,140
at the time of calculating quarters I want output as

Quarter Start End

q1     130     100

q2     90     140

Here start value for quarter is value of starting month for respective quarter & same for end value

1 Solution

Accepted Solutions
SergeyMak
Partner Ambassador
Partner Ambassador

If you have 12 month you need to change

Pick(Month,'Q1','Q1','Q1','Q2','Q2','Q2') AS Q

to

Pick(Month,'Q1','Q1','Q1','Q2','Q2','Q2','Q3','Q3','Q3','Q4','Q4','Q4') AS Q

And if you have more then 12 month, you should add year into grouping and joining.

Regards,
Sergey

View solution in original post

6 Replies
SergeyMak
Partner Ambassador
Partner Ambassador

Do you have date in your data or month only?

You want to get the results in load script or in a chart?

Regards,
Sergey
vijetas42
Specialist
Specialist
Author

In data I am having months and I want to calculate in script

SergeyMak
Partner Ambassador
Partner Ambassador

See an attached example

Regards,
Sergey
vijetas42
Specialist
Specialist
Author

Hi Thanks,

Its working but what if I am having whole 12 months data and if month data is not in order still it works?

SergeyMak
Partner Ambassador
Partner Ambassador

If you have 12 month you need to change

Pick(Month,'Q1','Q1','Q1','Q2','Q2','Q2') AS Q

to

Pick(Month,'Q1','Q1','Q1','Q2','Q2','Q2','Q3','Q3','Q3','Q4','Q4','Q4') AS Q

And if you have more then 12 month, you should add year into grouping and joining.

Regards,
Sergey
vijetas42
Specialist
Specialist
Author

Yes, Thanks I have tried for 12 month data as well as with random order of months still it's working

Thanks for the reply

Regards,

Vijeta