Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Shahzad_Ahsan
Contributor II

How to calculate Average and Max with Count Expression

Hi Everyone

I want to calculate average and Max for this expression

My Measure is like this:

Count(if(TRANSACTION_DATE >= today()-7 and TRANSACTION_TYPE='RECEIVE', TRANSACTION_ID))

I want to calculate Average and Max.

Please help me.

1 Solution

Accepted Solutions
pradosh_thakur
Valued Contributor III

Re: How to calculate Average and Max with Count Expression

Count(TransactionId)/Max( total aggr(Count(TransactionId),EmpCode)) as the expression for percentage

9 Replies
pradosh_thakur
Valued Contributor III

Re: How to calculate Average and Max with Count Expression

please check the date  once you may need to use date function there . Use this expression in measure

count({<TRANSACTION_TYPE={'RECEIVE'},TRANSACTION_DATE={">=$(=today()-7)"}>}TRANSACTION_ID)

MAXIMUM =

max( total AGGR(count({<TRANSACTION_TYPE={'RECEIVE'},TRANSACTION_DATE={">=$(=today()-7)"}>}TRANSACTION_ID),your_dim_here))

with respect to what you want to calculate the average ? you need to be more clear on that.

OmarBenSalem
Esteemed Contributor

Re: How to calculate Average and Max with Count Expression

u might need to add = before today()


count({<TRANSACTION_TYPE={'RECEIVE'},TRANSACTION_DATE={">=$(=today()-7)"}>}TRANSACTION_ID)

Shahzad_Ahsan
Contributor II

Re: How to calculate Average and Max with Count Expression

Thank You Pradosh

There is problem with the date

apart from date your expression is working

I need another thing

Here I have 3 columns

Emp CodeTransaction CountPercentage
1001325325/524*100
1002524524/524*100
1003478478/524*100

EmpCode & Transaction Count is calculated. I need a measure to calculate 'Percentage'

The formula should be

TransactionCount/Max(Transaction Count)*100

325/524*100

pradosh_thakur
Valued Contributor III

Re: How to calculate Average and Max with Count Expression

try adding = before today() as omar suggested i missed that. Date should work and it is still not then use  =date(today()-7,your_dateformat) in pace of today()-7

for percentage you can use[Column name]/ Max_expression *100

regards

Pradosh

pradosh_thakur
Valued Contributor III

Re: How to calculate Average and Max with Count Expression

thank you omar. edited now.

Shahzad_Ahsan
Contributor II

Re: How to calculate Average and Max with Count Expression

Hi Pradosh

Percentage is not calculating using max function.

It is showing same for all

I have attached sample data. please have a look

pradosh_thakur
Valued Contributor III

Re: How to calculate Average and Max with Count Expression

Count(TransactionId)/Max( total aggr(Count(TransactionId),EmpCode)) as the expression for percentage

Shahzad_Ahsan
Contributor II

Re: How to calculate Average and Max with Count Expression

Thank You So Much Pradosh

This is working

I was missing the 'Total' keyword

pradosh_thakur
Valued Contributor III

Re: How to calculate Average and Max with Count Expression

Pleasure Shahzad.

If your query is answered, Please close the thread by marking the correct answer and useful comments as USEFUL. It will help others who search for the similar issues in future.

Community Browser