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: 
Not applicable

Alternate states liking on dates

Hi,

I have three states default=ty rev, altenratestate=Last year rev and alternatestate2= last last year revenue

when I select multiple dates it totals the rows rather than giving me the comparison date individual total.I need to combine all three rows to say the this years date so all rows with their revenue to one row.

Capture1.PNGCapture2.PNG

Capture3.PNG

I have taken the total expression out of the TY REV so this then gives the daily revenue instead of the total £27,202. However the LY and LLY rev  is still summing. Please see screen shots attached.

Is there a way of getting round this?

Thanks,

Lauren

1 Solution

Accepted Solutions
sunny_talwar

Try these expressions:

Sum({$} LegFare)

Sum(Aggr(Above(Sum({alt} LegFare),GetSelectedCount(DepartureDate)), DepartureDate))

Sum(Aggr(Above(Sum({alt2} LegFare),GetSelectedCount(DepartureDate)), DepartureDate))


UPDATE: For this to work properly, you will need to make sure that the same number of DepartureDates are selected in all the three states. If that won't happen, then we might need to change the expression around.

View solution in original post

8 Replies
Not applicable
Author

A better example here i want to have all rows for 2014 on the 2015 dates without the total summing like the LLY column.

Capture.PNG

sunny_talwar

What are your selections in DepartureDate (alt) and DepartureDate (alt2)?

Not applicable
Author

from the purple boxes in the last image alt=LLY, alt2=LY

sunny_talwar

Try these expressions:

Sum({$} LegFare)

Sum(Aggr(Above(Sum({alt} LegFare),GetSelectedCount(DepartureDate)), DepartureDate))

Sum(Aggr(Above(Sum({alt2} LegFare),GetSelectedCount(DepartureDate)), DepartureDate))


UPDATE: For this to work properly, you will need to make sure that the same number of DepartureDates are selected in all the three states. If that won't happen, then we might need to change the expression around.

Not applicable
Author

Thanks again Sunny!

Could you please explain to me what's going on here in this expression:

Sum(Aggr(Above(Sum({alt2} LegFare),GetSelectedCount(DepartureDate)), DepartureDate))

sunny_talwar

So to get the values in the same rows, I just pushed them down the number of rows = Number of selections you have made in DepartureDate (Used Above() function with Offset (2nd argument) = GetSelectedCount(DepartureDate))

Sum(Aggr(..)) is used to get the correct total on the total row.

Does it make sense?

Not applicable
Author

Hi Sunny,

Please can I ask you delete this as it has an attachment on it?

Many Thanks,

Lauren

sunny_talwar

Attachment and image is removed