Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

If condition

The calculation below is not working,The if conditions are not getting satisfied. Please help

=IF(MATCH(FC.DATE_FISCAL_MONTH_NUM_LONG,3,6,9,12)>0 and Type='P',

SUM({<FC.DATE_FISCAL_YEAR_LONG={$(vCurrentYear)},FC.DATE_FISCAL_MONTH_NUM_LONG={">=$(vPrevMonth)<=$(vCurrentMonth)"}>}([Direct Hours]/200)),

SUM({<FC.DATE_FISCAL_YEAR_LONG={$(vCurrentYear)},FC.DATE_FISCAL_MONTH_NUM_LONG={">=$(vPrevMonth)<=$(vCurrentMonth)"}>}([Direct Hours]/160))

)

10 Replies
MK_QSL
MVP
MVP

try

=IF(MATCH(FC.DATE_FISCAL_MONTH_NUM_LONG,3,6,9,12)>0 and Type='P',

SUM({<FC.DATE_FISCAL_YEAR_LONG={'$(vCurrentYear)'},FC.DATE_FISCAL_MONTH_NUM_LONG={">=$(vPrevMonth)<=$(vCurrentMonth)"}>}([Direct Hours]/200)),

SUM({<FC.DATE_FISCAL_YEAR_LONG={'$(vCurrentYear)'},FC.DATE_FISCAL_MONTH_NUM_LONG={">=$(vPrevMonth)<=$(vCurrentMonth)"}>}([Direct Hours]/160))

)

Not applicable
Author

its giving me the same numbers, The set analysis i made for Year and Quarter are working but for Curr month
Vs  Prev month, this is coming wrong

MK_QSL
MVP
MVP

What is your variable definition for the above mentioned variables?

Not applicable
Author

Current Month:

=Max(IF(FC.DATE_FISCAL_YEAR_LONG=$(vCurrentYear),FC.DATE_FISCAL_MONTH_NUM_LONG))

PrevMonth:

=if($(vCurrentMonth)=1,12,$(vCurrentMonth) -1)

If the Month is multiple of 3(like 3,6,9,12)  then I need to divide the direct hours by 200 else by 160

Anonymous
Not applicable
Author

And, what is the value of FC.DATE_FISCAL_MONTH_NUM_LONG at time and point of calculation?  Is it defined?

Not applicable
Author

Yes it defined contains number(1,2,3..12)

Anonymous
Not applicable
Author

OK, I have to clarify my question...

If you use your expression in a chart where this field is an dimension, the match() function should work.  To make sure, just add it as an additional dimension.  If you use it in any other way, and multiple values are selected (or available) in this field, match returns null.  So "if" condition returns false.

Not applicable
Author

So how you want me to modify this one. Please help me.if you want I can share the sample file with you

Anonymous
Not applicable
Author

Just upload the file, and I (or anybody else) will take a look.