Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
hopkinsc
Partner - Specialist III
Partner - Specialist III

Where function in script

Hi,I am writing a VAT application and  i am trying to break down a SalesValue field in my script

E.g.

Sales Value =£1000 which is a total of £200 Vat Code A, £400 Vat Code B and £400 Vat Code C

I want to break this down in the script and make new fields something like:

Load...

SalesValue Where VATIndicator ='A' AS SalesValueA,

SalesValue Where VATIndicator ='B' AS SalesValueB,

SalesValue Where VATIndicator ='C' AS SalesValueC

From...

But i do not know how to do it..

I know i can use set analysis in a chart to total up each VAT Code but i thought it might be quicker to get it done in the script instead (As the script is reloaded out of hours)

Can anyone help please?

1 Solution

Accepted Solutions
jedgson
Creator
Creator

Try,

Load

     If( VATIndicator = 'A', SalesValue, 0) as SalesValueA,

     If( VATIndicator = 'B', SalesValue, 0) as SalesValueB,

     If( VATIndicator = 'C', SalesValue, 0) as SalesValueC

From ..

Jay

View solution in original post

1 Reply
jedgson
Creator
Creator

Try,

Load

     If( VATIndicator = 'A', SalesValue, 0) as SalesValueA,

     If( VATIndicator = 'B', SalesValue, 0) as SalesValueB,

     If( VATIndicator = 'C', SalesValue, 0) as SalesValueC

From ..

Jay