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: 
Anonymous
Not applicable

How to use if Condition in a set analysis

Hi,

I am trying to restrict the data based on month.

I have below expression in my straight table.

SUM({<TRptCont.RecordType = {'CL'}, TDimMonth.Month=, TDimMonth.MonthIndex = {"<=$(=MAX({test}TDimMonth.MonthIndex))"},TDimMonth.Year=,

TDimMonth.YearNo={">=$(vYR)"}>}(TRptCont.Cont_Count_1))

I want to incorporate the below if statement in the above expression.


=IF(TDimMonth.MonthIndex <= $(=MAX(TDimMonth.MonthIndex)) AND TDimMonth.MonthIndex <= $(=MAX({test}TDimMonth.MonthIndex)) , TDimMonth.Month)


When I am trying to do so I am getting all the value as 0.


Please suggest any solution for this.


Thanks in advance.

3 Replies
Anil_Babu_Samineni

Like this?

=IF(TDimMonth.MonthIndex <= MAX(TOTAL TDimMonth.MonthIndex) or TDimMonth.MonthIndex <= MAX(TOTAL {<test>}TDimMonth.MonthIndex) , TDimMonth.Month)

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
Anonymous
Not applicable
Author

No, It is not working.

Its still giving the same value.

And I have to use the If condition statement in the expression.

Eg : I have a list box which is having month from Jan15 to Dec 17 and having a table which is giving me Sum(Sales)

I want to restrict the Calculated value only till Jan15 to Dec15.

And I am not using the dimension in the table.

I want to use only expression.

Anil_Babu_Samineni

May be this?

Sum({<month = {">=$(=Date(Min(month), 'MMMYY'))<=$(=Date(AddMonths(month, -2), 'MMMYY')"}>} Sales)

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