Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
How to get previous quarter for ex:
i have 2022Q1 ,the previous quarter is 2021Q4, but for me getting 2022Q0,because i have use variables
left(datefield,4)&'Q'&ceil(Month(datefield/3)) for current quarter
left(datefield,4)&'Q'&ceil(Month(datefield/3))-1 for previous quarter
HI @Sunil_26
You need to adjust the date not the final result something like the below.
left(Addmonths(datefield-3),4)&'Q'&ceil(Month(Addmonths(datefield,-3)/3))
ok i will try and let you know if it works
hi is this works for only one qurter what if i change the quarter to 2022Q2, i need dynamically expresssion
IMO the easiest way to address such tasks is to use a running counter for the period field. This could be done with autonumber() within the master-calendar, like:
load *, autonumber(Year & Q) as RunningQ;
load *, ceil(Month / 3) as Q;
load *, year(Date) as Year, month(Date) as Month;
load date(from - 1 + recno()) as Date autogerate bis- from;
Similar stuff might be also done against YearMonth or YearWeek. Each needed period-field should be created there - in each case as numeric and if needed also as strings or dual() values. The numeric ones might not be shown anywhere but they are needed to calculate/compare anything against each other.
Beside this you could also create a working counter with something like this:
Year * 4 + Quarter as RunningQ
- Marcus