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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Karim_Khan
Creator III
Creator III

Set Analysis unable to exclude common record

Hi Team,

   I wanted to compare two dates value and need to show only those records which are not present in previous month last day and

present in current month last day i.e i wanted to exclude all common record between these two dates and put only non-matching records.

I have tried the below expression

varibale define

for getting last day of current  month

vLastDayPrevMon=MonthEnd(AddMonths($(vFromDate), -1))

LastDayCurrMon=MonthEnd($(vToDate))

=if(Date='$(vLastDayPrevMon)' AND Date='$(vLastDayCurrMon)',ID)

stalwar1

KK
1 Solution

Accepted Solutions
sunny_talwar

For the sample provided... this seems to work

Avg({<DESC = {"=Count(DISTINCT {<Date = {[$(=Date(Max(Date)))], [$(=Date(Floor(MonthEnd(Max(Date), -1))))]}>} Date) = 1"}>} 1)

View solution in original post

11 Replies
sunny_talwar

For the sample provided... this seems to work

Avg({<DESC = {"=Count(DISTINCT {<Date = {[$(=Date(Max(Date)))], [$(=Date(Floor(MonthEnd(Max(Date), -1))))]}>} Date) = 1"}>} 1)

Karim_Khan
Creator III
Creator III
Author

Hi Sunny Thanks for ur help a always bt still some challenges while trying to implement it with my dynamic calendar date

this exprssion in working for dynamic dates but while m trying to combine ur also its giving null values

=IF(Date='>$(=Date(vFromDate))<$(=Date(vToDate))',

Avg({<ID= {"=Count(DISTINCT {<Date= {[$(=Date(vFromDate))], [$(=Date(Floor(MonthEnd(vToDate))))]}>} Date) = 1"}>} 1))

KK
sunny_talwar

Can you share a sample to show the issue?

Karim_Khan
Creator III
Creator III
Author

sorry have missed one filter if will apply then its working

=Avg({<ID = {"=Count(DISTINCT {<DATE = {[$(=Date(Floor(MonthEnd(Max({<ID>}DATE), -1))))]}>} DATE) + Sum(0) = 0"}>} 1)

Thank You so much stalwar1

KK
sunny_talwar

Hahaha awesome and you deleted the whole post and rewarded yourself the correct response. Great going .

Karim_Khan
Creator III
Creator III
Author

m really sorry by mistakenly i selected that will rectify it now only. and have deleted that screenshot only.

KK
Karim_Khan
Creator III
Creator III
Author

stalwar1‌ sorry  it was mistake and unintentionally

KK
Karim_Khan
Creator III
Creator III
Author

Hi Sunny,

   Can u pls help me out to understand the below expression

=Avg({<ID = {"=Count(DISTINCT {<DATE = {[$(=Date(Floor(MonthEnd(Max({<ID>}DATE), -1))))]}>} DATE) + Sum(0) = 0"}>} 1)

KK
sunny_talwar

What do you not understand?