Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
BootCam
Creator
Creator

Previous Quarter Year Calculation

I have Quarter Year field in this format, 20183, 20182, 20181, 20174, 20173, 20172, 20171 and so on.

I would like to create a variable for the the previous quarter calculation.

So, When the user select 20183 they will see the current Quarter value and 20182 will be the previous Quarter value.

I was trying with this: =Left(QuarterYear,4)&(Right(QuarterYear,1)-1) but when i select 20181 its giving me 20180 rather than 20174.

Any help?

Labels (2)
22 Replies
BootCam
Creator
Creator
Author

Hi Sunny, 

As you mentioned,

So if i create the new field as 

=QuarterStart(MakeDate(Left(QuarterYear, 4), Right(QuarterYear, 1)*3)) as QuarterYear_New

 Then the set analysis would be:  

Sum({<QuarterYear_new = {"$(=QuarterStart(Max(QuarterYear_nee), -1))"}>} Measure)

 Is that right?

 

Thanks,

BC 

sunny_talwar

Yup, this

Sum({<QuarterYear_new = {"$(=QuarterStart(Max(QuarterYear_new), -1))"}>} Measure)

 

BootCam
Creator
Creator
Author

Thanks Sunny!

I am Not sure why but when i do sum(Measure) i get some value for example but with your calculation i get 0.

 

Thanks,

BC

sunny_talwar

Are you making selection in any date or time field?

BootCam
Creator
Creator
Author

Yes, I am making selections on the QuarterYear field. 

sunny_talwar

Then you need to ignore selection in that field because selection and set analysis are contradicting each other

Sum({<QuarterYear_new = {"$(=QuarterStart(Max(QuarterYear_new), -1))"}, QuarterYear>} Measure)

 

BootCam
Creator
Creator
Author

Hi Sunny,

If i cant get values by That field selections then the solution wont be useful for my situation. Smiley Sad

 

Thanks,

BC

 

sunny_talwar

My friend, have you even tried it? 🙂 do everything as you would want to... but just use the new expression
BootCam
Creator
Creator
Author

Hi Sunny, I actually tried before replying to you. Man Tongue

But ignoring the selection field has no effect on the calculation. So how do i get any previous period based on the selection if i cant select the field?

I am confused though. 

 

Thanks,

BC 

sunny_talwar

So, you select a single QuarterYear and use this expression

Sum({<QuarterYear_new = {"$(=QuarterStart(Max(QuarterYear_new), -1))"}, QuarterYear>} Measure)

and nothing happens? What do you mean when you say nothing happens? See 0s? or nothing get filtered out?

Would you be able to share a sample to show the issue? This can be a small issue, but very difficult to know without something to look at.