Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am attempting to create a nested if statement with several conditions. Below is how I have the expression formatted currently, however I am getting an error or 'IF takes 2-3 parameters,' which I believed I had
=if(mtrc_videoviews < 300 and brandID = 1, mtrc_impressions * 0.00936, mtrc_impressions * 0.00806, if(mtrc_videoviews < 300 and brandID = 2, mtrc_impressions * 0.00996, mtrc_impressions * 0.00762))
How can I correct
You cannot write two else part in if statement. so structure your if something like below
if(mtrc_videoviews < 300 and brandID = 1, mtrc_impressions * 0.00936,
if(<condition> , mtrc_impressions * 0.00806,
if(mtrc_videoviews < 300 and brandID = 2,
mtrc_impressions * 0.00996, mtrc_impressions * 0.00762)))
You need to write if condition for highlighted part.
if(mtrc_videoviews < 300 and brandID = 1,
mtrc_impressions * 0.00936, mtrc_impressions * 0.00806,
if(mtrc_videoviews < 300 and brandID = 2, mtrc_impressions * 0.00996, mtrc_impressions * 0.00762))
Is this what you are expecting?
=if(mtrc_videoviews < 300 and brandID = 1, mtrc_impressions * 0.00936,
if(mtrc_videoviews < 300 and brandID = 2, mtrc_impressions * 0.00996,
if(mtrc_videoviews >= 300 and brandID = 1, mtrc_impressions * 0.00806,
if(mtrc_videoviews >= 300 and brandID = 2, mtrc_impressions * 0.00762))))
So BrandID = 1 has two logic's based on video views similarly for BrandID = 2.
Hi Dear Evansabres
The highlighted part on Kush_qlik post is the wrong part of your script, you can try with the following sentence
=if(mtrc_videoviews < 300 and brandID = 1,
mtrc_impressions * 0.00936,
if(mtrc_videoviews < 300 and brandID = 2,
mtrc_impressions * 0.00996,
mtrc_impressions * 0.00762))
The format of this expression works, however I need to incorporate the highlighted portion of what I have below:
=if(mtrc_videoviews < 300 and brandID = 1, mtrc_impressions * 0.00936, mtrc_impressions * 0.00806, if(mtrc_videoviews < 300 and brandID = 2, mtrc_impressions * 0.00996, mtrc_impressions * 0.00762))
You cannot write two else part in if statement. so structure your if something like below
if(mtrc_videoviews < 300 and brandID = 1, mtrc_impressions * 0.00936,
if(<condition> , mtrc_impressions * 0.00806,
if(mtrc_videoviews < 300 and brandID = 2,
mtrc_impressions * 0.00996, mtrc_impressions * 0.00762)))