Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Qlik Community
- :
- All Forums
- :
- QlikView App Dev
- :
- Aggr with Two parameter Variable not working

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Not applicable

2016-10-25
03:21 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Aggr with Two parameter Variable not working

Hi All,

We have a scenario for Numerator and Denominator calculation. I have to consider some filters for Numerator and Denominator calculation.

One more condition we need to consider while calculating Numerator and Denominator which We have to look at Numerator and Denominator for each "MonthYear" and "Category" value should be '>' Zero, then only we have to take Numerator and Denominator for that particular "MonthYear" and "Category".

PFA .qvw and Data. We have used Aggr with SetAnalysis the expression is working fine.

The same way We have 100 No.of expressions. So we planned to use variable with two parameters. but it is now working.

Please help me to rectify the syntax problem.

Thanks in Advance,

Saranya.A

2,862 Views

1 Solution

Accepted Solutions

Not applicable

2016-10-26
03:16 AM

Author

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Thank you very much for all your support.

We have tried it in double dollar expansion format. Now it is working fine.

PFA which is udated with double dollar expansion variable with two parameters.

Thanks,

Saranya A.

2,551 Views

9 Replies

Aurelien_Martinez

Partner - Specialist II

2016-10-25
03:57 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi,

You can add an '=' to this variable : eNumerator, like

=sum({<SubType1={'X','Y'}>}Measure1)

Aurélien

edit : same thing for eDenominator

Help users find answers! Don't forget to mark a solution that worked for you!

2,550 Views

Not applicable

2016-10-25
04:03 AM

Author

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Thank you for the support Aurelien.

I have tried this, but actually I have to get the Expected result for Numerator is 640326 and Denominator is 35.

Then only my variable with parameter is correct.

Please suggest me to work on two parameter variable.

Thanks,

Saranya A.

2,551 Views

Aurelien_Martinez

Partner - Specialist II

2016-10-25
04:22 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

When you i do that

sum({<SubType1={'X'}>}Measure1) + sum({<SubType1={'Y'}>}Measure1)

it's working

The problem is in the ',' in set analysis...

Help users find answers! Don't forget to mark a solution that worked for you!

Not applicable

2016-10-25
05:24 AM

Author

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Thank you very much Aurelin.

It is meeting my requirement. Actually, I have shared sample expression. In real scenario we have 4 to 5 no.of modifiers, each modifier have multiple values. So splitting it for 100 expression is difficult task.

Is there any other way to acheive?

Thanks in Advance,

Saranya A.

2,551 Views

marcus_sommer

MVP

2016-10-25
07:47 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Take a look here: Re: variable with comma parameter.

- Marcus

Not applicable

2016-10-25
09:49 AM

Author

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi Marcus,

Thanks for your reply.

Now I understood the ',' is creating problem. But could not fix the issue.

Will please suggest me how to implement it?

Thanks in Advance,

Saranya

2,551 Views

marcus_sommer

MVP

2016-10-25
12:45 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

If your parameter which is another variable which include a whole expression could be globally calculated you could do something like this: Nesting Variables with parameters. But must be those expression calculate the results depending on certain dimensions this way isn't possible. In short I don't think that there is a way to nest such variables if they must be expanded in eachother.

An alternatively would be to do something like this as variable:

Sum(Aggr(if((

Sum({<$1={$2}>}$3))>0 and

(sum({<$4={'$(=replace($5, '+', chr(39) & chr(44) & chr(39)))'}>}$6))>0,(sum({<$4={'$(=replace($5, '+', chr(39) & chr(44) & chr(39)))'}>}$6)),0),MonthYear,Category))

and this as expression:

=$(eparameterVar_NrNew(Type, 'A', Measure2, SubType1, 'X+Y', Measure1))

to get:

- Marcus

Not applicable

2016-10-26
01:10 AM

Author

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Thank you very much Marcus,

I will try to implement the same concept into my application. In my case, passing parameter will differ for each and every expression, so i need to create multiple variables, to avoid these I will go for direct expression method only, instead of parameter with variables.

Thanks,

Saranya A.

2,551 Views

Not applicable

2016-10-26
03:16 AM

Author

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Thank you very much for all your support.

We have tried it in double dollar expansion format. Now it is working fine.

PFA which is udated with double dollar expansion variable with two parameters.

Thanks,

Saranya A.

2,552 Views