Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

SQL Coalesce and having clause in qlikview

Hi, I am New to Qlik and I got a requirement where I need to change the Coalesce and havng in qlikview. I tried few possible ways when not able to get the solution. I am providing the sql code below which i need to replicate same in the qlikview load statement

   SELECT [ID], MAX(Domain) AS Domain, MAX([Batches]) AS [batched received], SUM(delivered) as [Delivery Count]

       FROM "db".de."Dataset"

       GROUP BY id HAVING COALESCE(SUM(opens), 0) = 0

Any help would be appreciated

Thanks in advance

Suresh

1 Solution

Accepted Solutions
vishsaggi
Champion III
Champion III

You can use Alt() function with preceding load. May be try like

Table1:

LOAD ID, DOMAIN, Batches, Delivered, Opens;

SQL Select ID, DOMAIN, Batches, Delivered, Opens

FROM db.de.dataset;

NoConcatenate

Final:

LOAD *

WHERE OpenSum = 0;

LOAD ID,

           Max(Domain) AS Domain,

           Max(Batches) AS BatchedReceived,

           Sum(Delivered) AS DeliveryCount,

           Alt(Sum(Opens),0) AS OpenSum

Resident Table1

Group By ID;

Drop Table Table1;

View solution in original post

2 Replies
vishsaggi
Champion III
Champion III

You can use Alt() function with preceding load. May be try like

Table1:

LOAD ID, DOMAIN, Batches, Delivered, Opens;

SQL Select ID, DOMAIN, Batches, Delivered, Opens

FROM db.de.dataset;

NoConcatenate

Final:

LOAD *

WHERE OpenSum = 0;

LOAD ID,

           Max(Domain) AS Domain,

           Max(Batches) AS BatchedReceived,

           Sum(Delivered) AS DeliveryCount,

           Alt(Sum(Opens),0) AS OpenSum

Resident Table1

Group By ID;

Drop Table Table1;

Anonymous
Not applicable
Author

Hi Vishwa,

It worked Thank you.