# Qlik Sense App Development

New Contributor

## Urgent ** :( How to include 2/ 3 conditions in my expression

Hi all,

i need to find the average assessment scores base on their most recent submission for students from a university.

Conditions:

1. Region = ‘Ireland ‘

2. Most recent submission

Meaning to say, the previous submissions before their final one wouldnt be included in the average.

‌Since

score = scores for each student for each assessment ( has diff weightage )

date_ submitted = the submitted date in days ( numerical value ) since the start of the double

date = final submission date in days since the start of the module

i figured to get score from the most recent submission, I had to find max(date_submitted)<= date.

This was what i tried:

Avg({<region={‘Ireland’}, max(date_submitted<=date)>} score*weight/100)

it didn’t work   pls do help me if you are able to, Thankyou so much in advance, sincerely.

ps!! the formula to find the avg scores for my data without condition would be,

Avg(score*weight/100)  <—— it’s the Requirement

1 Solution

Accepted Solutions
MVP

## Re: Urgent ** :( How to include 2/ 3 conditions in my expression

May be this

FirstSortedValue({<region = {'Ireland'}>} Aggr(Avg({<region = {'Ireland'}>} score * weight/100), date_submitted), -date_submitted)

3 Replies
MVP

## Re: Urgent ** :( How to include 2/ 3 conditions in my expression

May be this

FirstSortedValue({<region = {'Ireland'}>} Aggr(Avg({<region = {'Ireland'}>} score * weight/100), date_submitted), -date_submitted)

Valued Contributor

## Re: Urgent ** :( How to include 2/ 3 conditions in my expression

You can only put dimensions on the left side of a set expression.

If you have a record key you could use something like:

[RecKey]={"=date=max(date_submitted)"}

and sometimes you need to evaluate the aggregates (can never figure out why/when you have to, so may have to play a bit):

[RecKey]={"=date=\$(max(date_submitted))"}

New Contributor

## Re: Urgent ** :( How to include 2/ 3 conditions in my expression

Thankyou soso much for your help i really appreciate it