Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
ganeshreddy
Creator III
Creator III

Logic help

Hi All,

I have table as attached, how to get the Opportunity value?. i.e

Opportunity = sum(Exclude the rows from the calculation where 'opp string' includes 'customer' value. So, if anywhere in the pipe separated listed and a single 'customer' appears, the row will be excluded).

Thanks,

Ganesh  

8 Replies
vishsaggi
Champion III
Champion III

May be try this?

Tab:

LOAD *, IF( Index(String, 'CUSTOMER') > 0, 1, 0) AS CustFlag;

LOAD customer,

     upper([opp string]) as String,

     Sales

FROM

[New Microsoft Excel Workbook.xlsx]

(ooxml, embedded labels, table is Sheet1);

I added couple of values as customer inside your opp string fields you can add and check.

After loading this using Straight table add like

Dim: customer, String

Expr: = Sum({< CustFlag = {0} >} Sales)

ganeshreddy
Creator III
Creator III
Author

Hi Nagaraju, thanks for your reply.

Here we can not hard code any customer names in logic as we have so many customers present in table and the calculation should apply to every row of the table, However the comparison has to happen in between the strings (customer, opp string) in the logic.

Please suggest on this.

Thanks,

Ganesh

ganeshreddy
Creator III
Creator III
Author

Hi tresesco

Can you help me on this.

Thanks,

Ganesh

tresesco
MVP
MVP

This?

Sum({<[opp string] -={"*customer*"}>}Sales)

jonathandienst
Partner - Champion III
Partner - Champion III

Create a table with customer as dimension and this as the expression:

Sum({<customer = {"$(=index('|' & [opp string] & '|', '|' & customer & '|') = 0)"}>} Sales)

or

Sum(If(index('|' & [opp string] & '|', '|' & customer & '|') = 0, Sales))


The pipes '|' avoid problems if one customer name is also part of another customer name (eg 'gia' and 'gia1' would be distinct)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
jyothish8807
Master II
Master II

Hi Ganesh,

Can you please explain your requirement a bit  more clearly ? What do you mean by customer name ?

Or you share a expected output from the file you have provided.

Then it will be easy for us to help you.

Br,

KC

Best Regards,
KC
jyothish8807
Master II
Master II

Jonathan's solution should work for you

Best Regards,
KC
vishsaggi
Champion III
Champion III

I did not meant to hardcode any values your excel sheet doesnot have any text customer so for testing purposes i added.