Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello all...
I want to write a simple condition to find the max Qtr among 3.
I tired using if..then..elsif statement for the below code but its not working...
and i tired to use nesting if condition...but it results a different output.
can anybody help me to find the other way to solve this..
sum({<QUARTER={"Q4"}>} INDICATOR_VALUE)
+
if
(
(
((sum({<YEAR={"2014"},QUARTER={"Q1"}>} INDICATOR_VALUE) ) >= (sum({<YEAR={"2014"},QUARTER={"Q2"}>} INDICATOR_VALUE) )) and
((sum({<YEAR={"2014"},QUARTER={"Q1"}>} INDICATOR_VALUE) ) >= (sum({<YEAR={"2014"},QUARTER={"Q3"}>} INDICATOR_VALUE) ))
),(sum({<YEAR={"2014"},QUARTER={"Q1"}>} INDICATOR_VALUE) ),
if(
(
((sum({<YEAR={"2014"},QUARTER={"Q2"}>} INDICATOR_VALUE) ) >= (sum({<YEAR={"2014"},QUARTER={"Q1"}>} INDICATOR_VALUE) )) and
((sum({<YEAR={"2014"},QUARTER={"Q2"}>} INDICATOR_VALUE) ) >= (sum({<YEAR={"2014"},QUARTER={"Q3"}>} INDICATOR_VALUE) ))
),(sum({<YEAR={"2014"},QUARTER={"Q2"}>} INDICATOR_VALUE)),
(sum({<YEAR={"2014"},QUARTER={"Q3"}>} INDICATOR_VALUE))
)
)
Thanks in advance..
Regards
kumar kondi
You have too many parenthesis that were confusing me. Can you test if the below expression works? Would you be able to share a sample data to work with?
Sum({<QUARTER={"Q4"}>} INDICATOR_VALUE)
+
If((Sum({<YEAR={"2014"},QUARTER={"Q1"}>} INDICATOR_VALUE) >= Sum({<YEAR={"2014"},QUARTER={"Q2"}>} INDICATOR_VALUE)) and
(Sum({<YEAR={"2014"},QUARTER={"Q1"}>} INDICATOR_VALUE) >= Sum({<YEAR={"2014"},QUARTER={"Q3"}>} INDICATOR_VALUE)),
Sum({<YEAR={"2014"},QUARTER={"Q1"}>} INDICATOR_VALUE),
If((Sum({<YEAR={"2014"},QUARTER={"Q2"}>} INDICATOR_VALUE) >= Sum({<YEAR={"2014"},QUARTER={"Q1"}>} INDICATOR_VALUE)) and
(Sum({<YEAR={"2014"},QUARTER={"Q2"}>} INDICATOR_VALUE) >= Sum({<YEAR={"2014"},QUARTER={"Q3"}>} INDICATOR_VALUE)),
Sum({<YEAR={"2014"},QUARTER={"Q2"}>} INDICATOR_VALUE),
Sum({<YEAR={"2014"},QUARTER={"Q3"}>} INDICATOR_VALUE)
))
Best,
Sunny
hello sunny
my task is to show an bar chart as :
1 bar for Q4 data for all year before 2014 + one bar max qtr in 2014.
and now problem is in finding the max Qtr in 2014...
so i need to use if then elsif statement for the same...
can u help me for the above coding...
or
simply can u show me how to use if then elsif statements in chart expression which contains set expressions within it...
thanks
kumar kondi
I suggest flagging the max quarter in your script and then use that to
MaxDate:
LOAD Max(Date) as MaxDate
Resident [Master Calendar];
LET vMaxDate = Peek('MaxDate');
DROP Table MaxDate;
Join ([Master Calendar]
LOAD QUARTER,
1 as Flag
Resident [Master Calendar]
Where Date = $(vMaxDate);
and then use the following expression
=Sum({<Flag={1}>} INDICATOR_VALUE)
Hi,
Your if else expression is fine.
Since if you need two bar chart then create two different expression
1 bar for Q4 data for all year before 2014
2 bar max qtr in 2014 (which is your if else expression)
Regards