Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
sanketkhunte
Creator II
Creator II

Qlikview Set Analysis

Hi there,

How can i convert below expression into Set Analysis ?

COUNT
(
DISTINCT
IF(
(
SC_ENABLED_STATE = 1 or
(
DATE(SC_LAST_CANCELLED_DATE,'MM/DD/YYYY') = '' AND SC_ENABLED_STATE = 1) OR
(
DATE(SC_LAST_CANCELLED_DATE,'MM/DD/YYYY') <= DATE(SC_START_DATE,'MM/DD/YYYY') ) OR
(
DATE( SC_LAST_CANCELLED_DATE,'MM/DD/YYYY') >= DATE(v_EndDate,'MM/DD/YYYY')) or
(
DATE(SC_LAST_CANCELLED_DATE,'MM/DD/YYYY') = '' AND SC_ENABLED_STATE <> 1 AND DATE(SC_MODIFY_DATE,'MM/DD/YYYY') >= DATE(v_EndDate,'MM/DD/YYYY') )
)

,
ID))




Many Thanks

Sanket

46 Replies
sunny_talwar

The way Max pointed out, that isn't working for you still even after changing the variable in your if statement?

sanketkhunte
Creator II
Creator II
Author

Its not working.

sanketkhunte
Creator II
Creator II
Author

Can I send you IF---ELSE expression again with v_EndDate variable ?

sunny_talwar

Not working is not very helpful? Is it giving you error the results aren't matching? What exactly is the problem? Can you share a sample with your expected output?

sanketkhunte
Creator II
Creator II
Author

Hi Sunny,

Here i am sending you snapshot where i am getting '0' value while using set analysis expression and getting correct result with IF---ELSE  statement.

set.png

sanketkhunte
Creator II
Creator II
Author

Hope this is helpful. Please let me know in case anything that i can provide on this.

Many Thanks

Sanket

PrashantSangle

Hi,

Just cross check that the date format of

field : PC_FIRST_ACTIVATED_DATE and

Variable : v_EndDate


or which ever you are comparing both need to be in same format .


Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
sunny_talwar

Here, give this a try:

Count(DISTINCT {(<PC_FIRST_ACTIVATED_DATE = {"<=$(=Date(v_EndDate, 'MM/DD/YYYY'))"}>)*
  (<SC_ENABLED_STATE={1}> +
  <SC_LAST_CANCELLED_DATE={''},SC_ENABLED_STATE={1}> +
  <SC_LAST_CANCELLED_DATE = {"<=$(=Date(SC_START_DATE,'MM/DD/YYYY'))"}> +
  <SC_LAST_CANCELLED_DATE = {">=$(=Date(v_EndDate,'MM/DD/YYYY'))"}> +
  <SC_LAST_CANCELLED_DATE={''},SC_ENABLED_STATE-={1},SC_MODIFY_DATE = {">=$(=Date(v_EndDate,'MM/DD/YYYY'))"
}>)}

PARTNER_ACCOUNT_ID)

Parts in red are the new additions.

One this to check is that PC_FIRST_ACTIVATED_DATE is in this format -> MM/DD/YYYY. If it is not then change date format in the red part to match with whatever format PC_FIRST_ACTIVATED_DATE is. To check you can create a list box and see what is the format it shows up with.

HTH

Best,

Sunny

sanketkhunte
Creator II
Creator II
Author

Many Thanks Sunny.

sanketkhunte
Creator II
Creator II
Author

Hi Sunny and team,

I don't know why getting '0' result while comparing 2 dates in set analsyis. I am using below expression

COUNT({< PC_FIRST_ACTIVATED_DATE = {"<=$(=Date(SC_LAST_CANCELLED_DATE,'YYYYMMDD')"} >} PARTNER_ACCOUNT_ID)


Please help on this.


Many Thanks.

Sanket