# QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Rules, plus terms and conditions, can be found here.
Valued Contributor II

## Why need to compute by if XXX >1,1 then compute the sales / target ?

Hi All

Recently i notice that some of the QV expert when they try to compute sales vs target , i notice they alway use the below expression :-

(if((

Sum({\$<year = {\$(=Max(year)-0)}, month = {"<=\$(=Max({<year={\$(=Max(year))}, sales = {'*'}>} month))"}>}sales/1000/Rate)

/

Sum({\$<year = {\$(=Max(year)-0)}, month = {"<=\$(=Max({<year={\$(=Max(year))}, sales = {'*'}>} month))"}>}sales_target/1000/Rate)

)

>1,1,

(

Sum({\$<year = {\$(=Max(year)-0)}, month = {"<=\$(=Max({<year={\$(=Max(year))}, sales = {'*'}>} month))"}>}sales/1000/Rate)

/

Sum({\$<year = {\$(=Max(year)-0)}, month = {"<=\$(=Max({<year={\$(=Max(year))}, sales = {'*'}>} month))"}>}sales_target/1000/Rate)

)))

All the while i am using below appraoch :-

sum({\$<year = {\$(=max(year))}, month = {"<=\$(=max({<year={\$(=max(year))}>} month))"}>} sales/Rate/1000)

/

sum({\$<year = {\$(=max(year)-0)}, month = {"<=\$(=max({<year={\$(=max(year))}>} month))"}>}sales_target/Rate/1000)

I Do notice the different of above 2 expression , mine is able to see the sales vs target actual % , but the first appraoch is stop at 100%.

May i know in what situation need to apply if ?

Paul

1 Solution

Accepted Solutions

## Re: Why need to compute by if XXX >1,1 then compute the sales / target ?

Yes, if we need the original % value, then we don't want to apply 'if' statement.

3 Replies

## Re: Why need to compute by if XXX >1,1 then compute the sales / target ?

Regarding the 1st expression, if we don't want to see more than 100% we can apply the if statement.

It is forcefully / manually make it as 100% when the Sales vs Target >100.

like

if(Sales vs Target > 100% then Make it as 100% (some of them don't want to see more than 100%),

else the normal calculation.

Valued Contributor II

## Re: Why need to compute by if XXX >1,1 then compute the sales / target ?

Hi Sir

Thank you very much for your clarify.

So can I said if I compute table to display target achievement . I should not apply if .

For plot % chart then I need to use if to limit 100%. Right ?

Paul

Sent from my iPhone

## Re: Why need to compute by if XXX >1,1 then compute the sales / target ?

Yes, if we need the original % value, then we don't want to apply 'if' statement.