Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Highlighted
Not applicable

Set identifiers in a If statement

Hi Everybody,

I am a new QlikView developper and I have a problem.

I load data in which there are three columns. The first column is registration_date and the second one is treatment_date and the last one is number_of_folder.

I would like to sum the number_of_folder column every time where registration_date equal treatment_date.

To do it I first wrote this statement :

Sum( If([registration_date] = [treatment_date], [number_of_folder] )

But I didn't work. I noticed that It's just because I had selected a range for registration_date and treatment_date both using a slider and It wasn't what I should do. I have to evaluate this activity without taking in account the selected treatment_date (It's used for another operation) but by using the selected registration_date

So, I try this statement where I try to specify the full data set using Set Analysis statement by hoping that in the If Statement, the comparaison between the two column date will be base from the full data set not from the data set obtained after selecting date but it doesn't work.

Sum( {1<[registration_date] = P([treatment_date]), [treatment_date]={"*"}>} If([registration_date]=[treatment_date], [number_of_folder]) )


Please how could I do it ? Thanks.

6 Replies
MVP
MVP

Re: Set identifiers in a If statement

Try:

=Sum( {< [treatment_date]=>} If([registration_date]=[treatment_date], [number_of_folder]) )


Not applicable

Re: Set identifiers in a If statement

Sum({<[number_of_folder]={" [registration_date] =[treatment_date]" }>} [number_of_folder])

teempi
Contributor II

Re: Set identifiers in a If statement

Hi,

I would create a new field in the script, something like this:

If([registration_date] = [treatment_date], [number_of_folder], 0) AS NewField

Then just sum that field up as usual and it should work.

-Teemu

Not applicable

Re: Set identifiers in a If statement

Hi tresesco,

Thanks but no changes. I get the same results with my statements.

Not applicable

Re: Set identifiers in a If statement

Hi Srashti,

Thanks but it doesn't work. I don't know how the statment works but it gives a result very far from the good result.

Not applicable

Re: Set identifiers in a If statement

Yes Its a good answer but I couldn't apply this because there are many indicators to calculate based on the same logic. So, just imagine I apply it in a large data sets.

Community Browser