Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Not applicable

How can i add Group field in attached expression (set analysis problem)

Hi Everyone,

The Below expression is written for working only individual fileds.

But my requirement is that i need to use Group instead of single field i.e; i need to have here GetCurrentField(BCgroup) where i highleted the expression in Red color and  GetCurrentField(DEgroup) in Blue color.

Pls share your ideas on this issue.

=count({$<BCShotFlowIndexA={">=$(bcVar1)<=$(bcVar2)"}>+$<DepoBCPeakVacA={">=$(DeVar1)<=$(DeVar2)"}>} LensKey)

Thanks

Tags (1)
1 Solution

Accepted Solutions
erich_shiino
Honored Contributor

How can i add Group field in attached expression (set analysis problem)

Hi,

I think you are pretty close.

Create two variables

vGroupBC

the content will be:

=GetCurrentField([BCgroup])

vGroupDE

the content will be:

=GetCurrentField([DEGroup])

The expression will be:

=count({$<$(vGroupBC)={">=$(bcVar1)<=$(bcVar2)"}>+$<$(vGroupDE)={">=$(DeVar1)<=$(DeVar2)"}>} LensKey)

13 Replies
erich_shiino
Honored Contributor

How can i add Group field in attached expression (set analysis problem)

Hi,

You have to create a variable, for example vGroup

the content of vGroup is

=GetCurrentField([BCGroup])

On set analysis, you call it like this:

SUM( {<$(vGroup)={A}>} VALUE1)

That's the idea of the syntax, you just need to adapt to your values and make it to the second group as well.

What I do, in these cases, I create a straight table chart, with no dimension and put the expression there with no labels. When you write the expression, QV will put it as the header of a column and you can see if it evaluates your variables correctly.

Hope it helps,

Erich

Not applicable

How can i add Group field in attached expression (set analysis problem)

Hi Erich,

Thans for your reply,

Can you send the brief explanation or send the set analysis expressin to me how should i change the actual expression.

Thanks...

erich_shiino
Honored Contributor

How can i add Group field in attached expression (set analysis problem)

Hi,

I think you are pretty close.

Create two variables

vGroupBC

the content will be:

=GetCurrentField([BCgroup])

vGroupDE

the content will be:

=GetCurrentField([DEGroup])

The expression will be:

=count({$<$(vGroupBC)={">=$(bcVar1)<=$(bcVar2)"}>+$<$(vGroupDE)={">=$(DeVar1)<=$(DeVar2)"}>} LensKey)

christian77
Valued Contributor

How can i add Group field in attached expression (set analysis problem)

Hi:

Lets try this other:

1st: Create your group/groups

2nd: GetCurrentField(YourGroup)

3rd: if(GetCurrentField(YourGroup)=Field1, Expression1,

      if(GetCurrentField(YourGroup)=Field2, Expression2, ...

and so on.

You´ll save the variable.

Notice that the color-sintax-algorithm is failing. Another bug of QV10. But it works anyway.

Not applicable

How can i add Group field in attached expression (set analysis problem)

Hi Erich,

Thanks for your reply,

Sorry what u send is not working..

if know any other solution please reply me...

Thanks..

Not applicable

How can i add Group field in attached expression (set analysis problem)

Hi Christian,

Thanks for your reply.

can you write the expression1 for me

If(GetCurrentField(Mygroup)=Field1,Expression1

Thanks,

christian77
Valued Contributor

How can i add Group field in attached expression (set analysis problem)

Hi, ravikumar_ajzaas:

I don´t know exactly what you want, I posted only an idea that you could use.

Neither I use those kind of sets so complicated. I’m a simple guy.

I see you have two groups. Are there in the same table?

GetCurrentField(BCgroup) gives you the current field that is showing in BCgroup. It can be only one, since it changes in the whole doc, and it works even if the table or the object does not contain that group.

I´d divide your set in two parts:

=count({$<BCShotFlowIndexA={">=$(bcVar1)<=$(bcVar2)"}> LensKey }

+

count({$<DepoBCPeakVacA={">=$(DeVar1)<=$(DeVar2)"}>} LensKey)

Now we have it easier.

If(GetCurrentField(BCgroup)=Field1, count({$<BCShotFlowIndexA={">=$(bcVar1)<=$(bcVar2)"}> LensKey }) )

+

If(GetCurrentField(DEgroup)=Field2,

count({$<DepoBCPeakVacA={">=$(DeVar1)<=$(DeVar2)"}>} LensKey)  )

Are we approaching?

erich_shiino
Honored Contributor

How can i add Group field in attached expression (set analysis problem)

Hi, Cristian. I can be complicated to break that set analysis into a sum of two expression.

If you do you can count the same registers twice

That set analysis solve the overlap between sets of registers.

ravikumar_ajzaas, did you include the "=" on the variable content?

What do you get when you put those variables on a text box?

Not applicable

How can i add Group field in attached expression (set analysis problem)

Hi Christian,

Thanks for your reply

But this is not working.

If you have any other solution reply me...

Thanks....

Community Browser