Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

First Non-zero value in a chart

Sample file attached. Expectation is to have in FinalResult column, first non-zero value from the grouping if Sum is zero:

  

Cat2=Cat1&'-'&Cat3Sum(Value)Final Result
1A-X28.228.2
2A-X29.329.3
3A-X029.3
4A-X029.3
5A-X029.3
1A-Y22.622.6
2A-Y21.921.9
3A-Y021.9
4A-Y021.9
5A-Y27.627.6
1B-X23.423.4
2B-X29.229.2
3B-X029.2
4B-X23.823.8
5B-X25.725.7


Above() only works for one-level above. Trying to see if FristSortedtValue() would work.

Thank you.

18 Replies
sunny_talwar

Again this is just a sample and the actual expression might be more complex (instead of Sum(Value) if it was Sum(Aggr(FirstSortedValue(Aggr(Sum(Value), Date), -Date), Date, OtherDimensions)) or something)... would you still want to do this in the backend?

Anonymous
Not applicable
Author

Thank you both. Client's requirement was to do it on chart level. But thank you for your input.

sunny_talwar

This?

Capture.PNG

Expression:

If(Sum(Value) <> 0, Sum(Value), Above(TOTAL Column(1)))

jayanttibhe
Creator III
Creator III

Depends on the requirement; If target expression where he needed non zero values of row above look like the one you have shown, I would first get additional field with that complex expression and then would apply the same logic  on that field 

sunny_talwar

Again, I don't think this is always a good idea... but if you think that's the best way... then ya that is always an option

Anonymous
Not applicable
Author

Thank you Sunny, looks like Jayant's solution is close to what client is looking for.

sunny_talwar

Sounds good... I thought your expression was complicated and that is why you wanted to do this on the front end. If that's what you need. I suggest marking his response as correct and close this thread

Best,

Sunny

Anonymous
Not applicable
Author

Ideally, was looking for only front-end option but seems like there's a compromise on it now.

sunny_talwar

That's great.... Backend should always be preferred over front end. Wise decision