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

Set Analysis

I have a field 'SET_STATUS_DATE' I will need help with the syntax for  <=  date comparison for this field using set analysis.

13 Replies
Anil_Babu_Samineni

There are many ways for this scenario, For now few as follows

1) Sum(If(SET_STATUS_DATE=Compare_Field_Name, 1,0))

2) Sum({<SET_STATUS_DATE = {"=SET_STATUS_DATE = Compare_Field_Name"}>} 1)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
dplr-rn
Partner - Master III
Partner - Master III

not completly clear what you are trying to achieve. but in addition to @Anil_Babu_Samineni 

if you want to use set analysis to get date ranges for your date field. you can use below syntax (this gives last 2 months Sales 

Sum( {<OrderDate={"<=$(=Max(OrderDate)) >=$(=MonthStart(Addmonths(Max(OrderDate),-2)))"}>} LineSalesAmount)

dplr-rn
Partner - Master III
Partner - Master III

kabibi15
Contributor III
Contributor III
Author

is not giving me the desired results.

dplr-rn
Partner - Master III
Partner - Master III

Share more details please. Whatever we provided was based on assumptions.

kabibi15
Contributor III
Contributor III
Author

the requirement is if end user select SET_STATUS_DATE field  for example "12/16/2015' with the <= syntax the result should be  everything less than that date or equal to that date like 2015,2014,2013,2012, etc. Thanks.

dplr-rn
Partner - Master III
Partner - Master III

this should work

 {<SET_STATUS_DATE={"<=$(=Max(SET_STATUS_DATE)) )"}>} 

 

sometimes if the date format is not set correctly you may need to include that around the Max function

kabibi15
Contributor III
Contributor III
Author

Do i put this {<SET_STATUS_DATE={"<=$(=Max(SET_STATUS_DATE)) )"}>}  on the data  calculation condition expression?

dplr-rn
Partner - Master III
Partner - Master III

In your Measure expression.