Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I need help in writing one expression in line chart.
if(DATE <= vMAXDate, sales, sales-trend)
Kindly let me now if any other information required.
Thanks
Avneet
What is the issue you are facing with the current expression?
Attach a sample application. or the error you are getting with the expression.
What date format you are using?
condition says if date is <= max(date) then show sales
else sales-trend
my date is from 02.25.2016 to 02.08.2016
maxdate is 03.31.2016
so till 03.31.2016 it should show sales and for rest sales -trend.
but its displaying sales-trend value through out
>>if(DATE <= vMAXDate, sales, sales-trend)
>>but its displaying sales-trend value through out
Because you are using naked fields (that is fields not inside an aggregation function like Sum(), Min(), Count()...). The DATE value is not unique in this context, so it is always evaluated as null, so the comparison evaluates as false and you get sales-trend as a result.
You need something like
=Sum(If(DATE <= vMAXDate, sales, sales-trend))
Or make sure that each line of the table/chart always has only one possible value of DATE.
Thanks Jonathan ,
=Sum(If(DATE <= vMAXDate, sales, sales-trend))
its still displaying same values (sales-trend)
How is vMAXDate defined? Have you tried the expression with a literal value instead of a variable (for testing your logic)? Are the date values strings or proper numeric date values?
I suggest you post a small sample qvw that illustrates your problem.
problem is solved.
it was format issue. DATE was in YYYYMMDDHH
and maxdate was YYYYMMDD
Thanks guys for you time.