Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Shahzad_Ahsan
Creator III
Creator III

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
Master II
Master II

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

Learning never stops.

View solution in original post

9 Replies
pradosh_thakur
Master II
Master II

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.

Learning never stops.
OmarBenSalem

u might need to add = before today()


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

Shahzad_Ahsan
Creator III
Creator III
Author

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
Master II
Master II

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

Learning never stops.
pradosh_thakur
Master II
Master II

thank you omar. edited now.

Learning never stops.
Shahzad_Ahsan
Creator III
Creator III
Author

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
Master II
Master II

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

Learning never stops.
Shahzad_Ahsan
Creator III
Creator III
Author

Thank You So Much Pradosh

This is working

I was missing the 'Total' keyword

pradosh_thakur
Master II
Master II

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.

Learning never stops.