
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is there a way to add/define subtotals at different levels in a P&L Pivot?
I have a P&L structure like below, but i dont want to pre define the values for subtotals such as "Net Sales revenue". Instead I want to define it as gross sales revenue - Less returns and allowances to be calculated dynamically.
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tried using sample Data. Grouped and subtracted "gross revenue - less allowance" in separate tables in backend for MTD & YTD.
Hope this is what you were looking for. If this didn't help, please share sample data. You can jumble the numbers
Output:
Regards,
Aditya

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What do you mean by predefined values for "Net Sales revenue" ?
Are these values from provided screenshot fixed ? Also what formula is used to calculate allowances if you want it to be calculated dynamically ?
Regards,
Aditya

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the above screenshot all the values are fixed/hardcoded.
In my scenario, values for 'gross sales revenue ' and 'Less returns and allowances' are fixed, 'Net Sales revenue' is a calculated field with the below formula
Net Sales revenue=Gross sales revenue - Less returns and allowances

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tried using sample Data. Grouped and subtracted "gross revenue - less allowance" in separate tables in backend for MTD & YTD.
Hope this is what you were looking for. If this didn't help, please share sample data. You can jumble the numbers
Output:
Regards,
Aditya

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Aditya, this solution is working. Just one followup, what if we have more than one field to add /subtract?
Will peek() work in that case also?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In that case, you will have to mention row number in peek() function of the second/third field.
For eg:
Balance - peek(Balance) - peek(Balance,-2) as Balance_New
If you want to learn how peek() works, here's the link of Qlik Support Article:
How Peek() function works - detailed explanation - Qlik Community - 1801695
If the solution helped, Please don't forget to mark it as a solution !
Regards,
Aditya
