Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have a list box , from which I have to select two values and with respect to that . I have a straight table . where I need to calculate
Month1 and month2
for example:
month 1 : Oct_15
month 2 : Mar_15
in the expression for straight table I need sum(oct_15) values
and in second expression I need sum (Mar_15) values
it looks simple , but I know how to calculate present month vs previous month
but my task is : user can select 2 two different months and with respect to that the two columns in expression should change respectively .
hope I am clear
Thanks in advance
I think you should be able to use Alternate States to achieve what you are looking for.
UPDATE: Attaching a sample to help you understand what I am trying to say:
Dimension: MonthYear
Expression: =Sum({[AS1] + [AS2]}Value)
Where AS1 and AS2 are both alternate states and the two month year boxes drive the selection.
Hi Aditya,
You can replicate the month field again in script with a new name and then you can use then as to different list box, so you can restrict your expression on the list box selection.
tab1:
Load Month
from<>
Load
Month as NewMonth
resident tab1;
In expression1:
sum({<Month=>}Sales)
Expresion2:
sum({<NewMonth=>}Sales)
Regards
KC
one idea:
define two variables
Var1: =subfield(Concat(distinct yourdatefield,','),',',1)
Var2: =subfield(Concat(distinct yourdatefield,','),',',2)
and use those variables in your expressions
hi
Create one more listbox with same field aliased in script (Month)
now assign a new alternate state to each list box (say A1to Month1 ,A2 to Month2)
Now Expressions are:
1) Sum({[A1]<Month2=$::Month2>}sales)
2) Sum({[A2]<Month1=$::Month1>}sales)
PFA for reference
Hi sunny , I used these alternate states
my expressions are
1. sum({State2}{<cube_type ={'1'},version={'Scenario Plan'},version_date={'Today'},term={'*'}>}Value_CurrentMonth)
2. sum({State2}Value_CurrentMonth)
for expression 2 the value are coming right but when i am using it with other filters , I am not getting any result
I am getting month as apr_14 for first variable and apr_15 for second variable, even though I have not selected my list box which is map_period
1.subfield(Concat(distinct Map_Period,','),',',1)
2.subfield(Concat(distinct Map_Period,','),',',2)
could you tell me what the variable is doing here
hi
You should add all the filters which are using for selections to the exp ( like Year=$::Year )
Please share your qvw file
I suppose that this is the order without selecting something (are both months on top of list?)
to be sure that 2 and only 2 months are selected you should use
if (getselectedcount(Map_Period)=2, subfield(Concat(distinct Map_Period,','),',',1) and for 2. variable as well
Hi Aditya,
If you pick two months in your listbox this expression will give the sum you need for the first one selected
sum({$<Month = {$(=SubField(GetFieldSelections(Month,'|',GetSelectedCount (Month)),'|',1))}>}Value)
and this
sum({$<Month = {$(=SubField(GetFieldSelections(Month,'|',GetSelectedCount (Month)),'|',2))}>}Value)
will give the other.
I think the order will be determined by the load order of the Month field values.
Hope this helps