Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am trying to write a previousQuarter variable that is comprised of the following:
= if
(
GetFieldSelections([Quarter]) = 'Q1',
[Deposit Year] = (GetFieldSelections([Deposit Year]) - 1) and (Quarter = 'Q4'),
[Quarter] = 'Q' & (Right(Quarter, 1) - 1)
)
I need this variable to use in pulling the previous quarter balance, and the if() here needs to be able to handle when Q1 is selected and so there needs to be a comparison to the previous year's Q4 balance.
I think that maybe "[...] = x" is not appropriate syntax; so is there a proper way to write this, or am I going about this the wrong way?
Thanks!
Edit: Added sample .qvw.
Message was edited by: Tyler Tollin
Thanks Sunny. Is it normal for this not to work at the record level?
When I use
=sum({<[Record Date] = P([Previous Quarter End]), [Deposit Month], [Deposit Quarter], [Deposit Year]>} [Current Balance Amount])
for column Previous Qtr Bal, the below results. That's the right value for that date, but it should be in a single record. I've tried using variables, but that returns 0.
%DepositFact_PK | =[Record Date] | =RecordYYYYMM | =[Current Balance Amount] | =[Previous Quarter End] | Previous Qtr Bal |
---|---|---|---|---|---|
3/1/2018 | 201803 | 157.7900 | 12/1/2017 | 303.7000 | |
201712|50546 | 303.7000 | ||||
201803|50546 | 3/1/2018 | 201803 | 157.7900 | 12/1/2017 | 0.0000 |
Since date is part of the dimension, you will need to use Inter-Record Functions here... may be with Above()
=Above(Sum({<[Record Date] = P([Previous Quarter End]), [Deposit Month], [Deposit Quarter], [Deposit Year]>} [Current Balance Amount]))