Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Total for variable

Hi

I have expression in table called 'vPass' that return result 0 or 1.

The vPass value is varible called 'vCalTrueFalse':

vPass =$(vCalTrueFalse).

I need to create total field for vPass in TextObject at dashboard.

I tried ' Sum($(=vCalTrueFalse))' but it give me an error: 'Nested aggregation not allowed'.

How can I do it?

Thanks!

26 Replies
Anonymous
Not applicable
Author

Hi,

Try either one and substitute the correct fieldnames?

SUM(AGGR(SUM(if(MATCH('$(vCalTrueFalse)' ,'PASS'), 1,0)),DashboardName, ReportParam))

or

SUM(AGGR(SUM(if(MATCH('$(=vCalTrueFalse)' ,'PASS'), 1,0)),DashboardName, ReportParam))

Hopefully that helps!

uacg0009
Partner - Specialist
Partner - Specialist

Hi Ravit,

Please see the attachment, any questions or problems please tell me.

Total for variable.PNG

Thank.

Aiolos Zhao

Anonymous
Not applicable
Author

err.png

Got this error in two options...

Anonymous
Not applicable
Author

Hi

I cannot open the attched file.

Can you write the formula?

Thanks

uacg0009
Partner - Specialist
Partner - Specialist

Hi Ravit,

The expression is :

=sum($(vpass))/Count($(vpass))

and the important is the variable :

in script :

set vpass = if(Pass = 'Fail',0,if(Pass = 'Pass',1));

Any questions please tell me.

Aiolos Zhao

Anonymous
Not applicable
Author

Hi

I try to do what you suggest and I get '-' result in grade. I will explain what I did:

Since Pass and vPass are varibles (and not table columns) ,

I defined 3 new varibles in my script:

set vsResult =if(DashboardID =1 , ROUND((SUM(ColumnB_Value)/Count(ColumnB_Value))*100, 2),

if ((DashboardID = 5 or DashboardID = 7) ,AVG(ColumnB_Sum),

avg(ColumnB_Value)));

set vtPass = if((ParamID =98 or ParamID=99) and  $(vsResult)<vMCS,'Fail',

if((ParamID =102 or ParamID=100) and TestnameID<3 and $(vsResult)<vGoodput, 'Fail',

if(DashboardID =1 and $(vsResult)<Connectivity,'Fail',

if(DashboardID =5 and $(vsResult)<TotalSamplingTime, 'Fail',

if((ParamID =102 or ParamID=100) and TestnameID>2 and $(vsResult)<vGoodput_FDX, 'Fail','Pass')))));

set vsPass = if(vtPass = 'Fail',0,if(vtPass = 'Pass',1));

Then I set this expression in Grade textBox:

=sum($(vsPass))/Count($(vsPass))

See picture:

q.PNG

Get '-' result in grade 😞


What's wrong?


Thanks

uacg0009
Partner - Specialist
Partner - Specialist

Hi Ravit,

You data seems a little complex, so I didn't use your data to test, Last time I thought that the Pass is a column, now I change my code :

set vtPass = if(DashboardName = 'Connectivity','Fail','Pass');

set vsPass = if($(vtPass) = 'Fail',0,if($(vtPass) = 'Pass',1));

LOAD * INLINE [

    DashboardName, ReportParam

    Connectivity, Connect

    Connectivity, Disconnect

    Connectivity, Ping

    Connectivity, Scan

    Performance, PingLatency

    Performance, MCS STA

    Performance, MCS AP

    Performance, TxGoodput

    Performance, RxGoodput

    Power, Power

    Stability, Link stability

    System, PER

    System, FA

    System, BF

];

And in text object :

=sum($(vsPass))/Count($(vsPass))

The result :

Total for variable2.PNG

Aiolos Zhao

Anonymous
Not applicable
Author

Hi

Thanks for your answer .

I did all you suggest beside this code:

LOAD * INLINE [

    DashboardName, ReportParam

    Connectivity, Connect

    Connectivity, Disconnect

    Connectivity, Ping

    Connectivity, Scan

    Performance, PingLatency

    Performance, MCS STA

    Performance, MCS AP

    Performance, TxGoodput

    Performance, RxGoodput

    Power, Power

    Stability, Link stability

    System, PER

    System, FA

    System, BF

];

What the  meanning of this code? Why I need it?

Thanks

uacg0009
Partner - Specialist
Partner - Specialist

Hi Ravit,

I just pasted all my code to you, that table is my data, because I don't have the data source of yours. So I created a table to make it, actually you don't need it....

Have you solved your problem?

Aiolos Zhao

Anonymous
Not applicable
Author

I see.

No, still I get this error:

err.png