Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Ask for Expression

Hi,

I have a data like this:

    

ITEM_IDPART_IDDATEAVG_RHCalculation
PP112-Feb-20187288.219505.7 - 7288.21
PP114-Feb-20187288.219505.7 - 7288.21
PP106-Jun-20188726.469505.7 - 7288.21
PP113-Aug-20189505.79505.7 - 7288.21
PP205-Jan-20186732.47288.21-6732.4
PP222-Jan-20187060.957288.21-6732.4
PP229-Jan-20187162.557288.21-6732.4
PP205-Feb-20187267.17288.21-6732.4
PP212-Feb-20187288.217288.21-6732.4

I want to get AVG_RH value in max(DATE) and Min(DATE) for each ITEM_ID and PART_ID.

For example ITEM_ID = P and PART_ID = P1

I want to get AVG RH in MAX DATE (13-Aug-2018) and MIN DATE(12-FEB-2018) so the result must be in Calculation column above.

Can somebody help me.

Thanks

1 Solution

Accepted Solutions
Anil_Babu_Samineni

Try this way? Not tested - But this may work.

If(DATE=Max(TOTAL <PART_ID> DATE), Sum(TOTAL <DATE,PART_ID> AVG_RH)) & '-' & FirstSortedValue(TOTAL <PART_ID> AVG_RH, Aggr(Sum(AVG_RH), PART_ID))


Or

If(DATE=Max(TOTAL <PART_ID> DATE), Sum(TOTAL <DATE,PART_ID> AVG_RH), Sum({<DATE={"$(=Max(DATE))"}>} AVG_RH)) & '-' &

FirstSortedValue(TOTAL <PART_ID> AVG_RH, Aggr(Sum(AVG_RH), PART_ID))


Or

FirstSortedValue(TOTAL <PART_ID> AVG_RH, -Aggr(Sum(AVG_RH), PART_ID))-FirstSortedValue(TOTAL <PART_ID> AVG_RH, Aggr(Sum(AVG_RH), PART_ID))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

5 Replies
Anonymous
Not applicable
Author

Where do you want to see the result? text object?

PrashantSangle

Is avg rh coming  from back end or you are calculating it at front end???

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Anil_Babu_Samineni

Try this way? Not tested - But this may work.

If(DATE=Max(TOTAL <PART_ID> DATE), Sum(TOTAL <DATE,PART_ID> AVG_RH)) & '-' & FirstSortedValue(TOTAL <PART_ID> AVG_RH, Aggr(Sum(AVG_RH), PART_ID))


Or

If(DATE=Max(TOTAL <PART_ID> DATE), Sum(TOTAL <DATE,PART_ID> AVG_RH), Sum({<DATE={"$(=Max(DATE))"}>} AVG_RH)) & '-' &

FirstSortedValue(TOTAL <PART_ID> AVG_RH, Aggr(Sum(AVG_RH), PART_ID))


Or

FirstSortedValue(TOTAL <PART_ID> AVG_RH, -Aggr(Sum(AVG_RH), PART_ID))-FirstSortedValue(TOTAL <PART_ID> AVG_RH, Aggr(Sum(AVG_RH), PART_ID))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

Hi,

Thanks for your solution, it solved my problem perfectly !

Anil_Babu_Samineni

Glad it worked, Which one worked for you?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful