Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

morenoju
Contributor III

FirstSortedValue based on two fields

Hi all,

I have some records called "incidents" in my DB and I wanted to get the one with the longest duration. I did this and worked fine:

FirstSortedValue({1<IsPlannedIncident={"0"},EventStatusId={"22"}>} TotalIncidentDuration,-TotalIncidentDuration, 1)

Now I want to use another field called EventImapctId. I want to get the duration of the incident with highest impact, but this is returning a null:

FirstSortedValue({1<IsPlannedIncident={"0"},EventStatusId={"22"}>} TotalIncidentDuration,-EventImpactId, 1)

It's returning a null. Is it maybe because I many incidents with same impact and Qlik Sense doesn't know which one to choose? Is it possible to write the expression so in case of incidents with same impact it takes the one with longest duration?

Thanks,

Juan

Tags (2)
Community Browser