Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
BartVA
Creator
Creator

Sum of Latest Values in Week, in Pivot Table

I have a data table in the following format, see attached csv for an export (of randomized data).

BartVA_0-1708446557706.png

These concern End Balances, by day/company/journal/currency, of bank accounts.

I need to show in a pivot, with YearWeek in the rows, and currency_id in the columns, the total balance_end_real for that week.

So I need to 1) take all the balance_end_real's of the LastDateInWeek (Date=LastDateInWeek) and 2) sum these by currency.

If needed, I need to be able to filter by company_id and journal_id, and/or add these as row levels to the pivot.

I tried 
sum(AGGR(FirstSortedValue(balance_end_real), -YearWeek, company_id, journal_id, currency_id))
and
Sum(Aggr( If(date = LatestDateInWeek, balance_end_real), YearWeek ))
but both give all zero values.

Labels (4)
2 Replies
Anil_Babu_Samineni

@BartVA When I flag the dates, I see nothing that is match. Could be the reason that you have zero.

Anil_Babu_Samineni_0-1708459625597.png

 

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
BartVA
Creator
Creator
Author

Hi, thanks for looking into my question!

I made a few changes and now have Dates that are equal to Last Dates. See also stored table in attachment.

BartVA_0-1708507225682.png


(Formula is: If(date = LatestDateInWeek, 1, 0) as DateIsLatestDateInWeek;)

Still, pivot shows zero's only.

BartVA_1-1708507348006.pngBartVA_2-1708507368014.png