Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am trying to accomplish a nested if condition to an expression but i am not able to successfully implement it. I am comparing a sales trend, and my expression is given below,
if(((Sum({$<Year = {$(=Only(Year ))}>}[Net Sales])) - (Sum({$<Year = {$(=Only(Year)-1)}>}[Net Sales]))) = 0,'qmem://<bundled>/BuiltIn/arrow_e_y.png', if(((Sum({$<Year = {$(=Only(Year ))}>}[Net Sales])) - (Sum({$<Year = {$(=Only(Year )-1)}>}[Net Sales]))) > 0,'qmem://<bundled>/BuiltIn/arrow_n_g.png','qmem://<bundled>/BuiltIn/arrow_s_r.png')
I am trying to implement image to this expression. characters starting with "gmem" are nothing but the link to images. If I use a single if condition, it works perfectly fine. But if I want to have three possibilities (using 2 if conditions), then it is not working. Please help.
Thanks,
Sivacharan
Perhaps a parenthesis issue. Put one more closing parenthesis at the end and try.
Perhaps a parenthesis issue. Put one more closing parenthesis at the end and try.
Hi,
Check this
if(Sum({$<Year = {$(=Max(Year))}>}[Net Sales]) - Sum({$<Year = {$(=Max(Year)-1)}>}[Net Sales]) = 0, 'qmem://<bundled>/BuiltIn/arrow_e_y.png',
if(Sum({$<Year = {$(=Max(Year ))}>}[Net Sales]) - Sum({$<Year = {$(=Max(Year)-1)}>}[Net Sales]) > 0, 'qmem://<bundled>/BuiltIn/arrow_n_g.png','qmem://<bundled>/BuiltIn/arrow_s_r.png'))
Hope this helps you.
Regards,
jagan.
Hi
Thanks for the quick reply.
I Actually want to calculate the sum for the currently selected year - previous year . like if I select year 2009, then it should calculate for sales of 2009 - sales of 2008 or vice versa. Believe max won't work the way I want..
Hi,
I you select 2009, then Max(Year) is 2009 and Max(Year) -1 is 2008, this is what I am doing, if you do not give Max() and use Only(), you will get null value when no year is selected. That is why I used Max(), if Year is always selected one then you can use Only().
Is above expression working? Did you checked?
Hope this helps you.
Regards,
Jagan.
Hi
I would suggest to use the following expression
=PICK(SIGN(SUM({$<Year = {$(=Max(Year))}>}[Net Sales]) - SUM({$<Year = {$(=Max(Year)-1)}>}[Net Sales])) + 2, 'qmem://<bundled>/BuiltIn/arrow_s_r.png', 'qmem://<bundled>/BuiltIn/arrow_e_y.png', 'qmem://<bundled>/BuiltIn/arrow_n_g.png')
if(Sum({$<Year = {$(=Only(Year ))}>}[Net Sales]) - Sum({$<Year = {$(=Only(Year)-1)}>}[Net Sales]) = 0,'qmem://<bundled>/BuiltIn/arrow_e_y.png',
if(Sum({$<Year = {$(=Only(Year ))}>}[Net Sales]) - Sum({$<Year = {$(=Only(Year )-1)}>}[Net Sales]) > 0,'qmem://<bundled>/BuiltIn/arrow_n_g.png','qmem://<bundled>/BuiltIn/arrow_s_r.png'))
Thanks for pitching in the issue with my expression.. Adding the parenthesis at the end did work.. So dumb of me
Yep, it does work. I missed the parenthesis at the end.. Max also works fine.. However, I have a condition to display the column only if there is one selection is made.. But this is a good learning to display the max selection when I dont use that condition.. Thanks
This too does work. Thanks