Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Prads_PFUEAME
Contributor II
Contributor II

Issue in achieving multi headers in Pivot in Qlik Sense UI

Hello All,
I am looking for Pivot - multi row Expression solution:
Attached is the Excel picture which is my requirement.

Prads_PFUEAME_0-1778412582242.png

I have achieved the arrangement as is: look at the Pivot created in the Qlik Sense (Enterprise / Windows)

Prads_PFUEAME_2-1778413233752.png

 

Prads_PFUEAME_1-1778412736083.png
Code used:

Script Editor :
VC_Metric_Header:
LOAD * INLINE [
R1_Header, R2_Header, SortOrder
Actual Net Sell-In Revenue, Revenue, 1
Actual Net Sell-In Revenue, GM, 2
Actual Net Sell-In Revenue, GM%, 3
Cross Border Adjustments, Revenue, 4
Cross Border Adjustments, GM, 5
Cross Border Adjustments, GM%, 6
Adjusted Net Sell-In Revenue, Revenue, 7
Adjusted Net Sell-In Revenue, GM, 8
Adjusted Net Sell-In Revenue, GM%, 9
Adjusted Net Sell-In Revenue, Weighted Revenue, 10
Strategic, Volume, 11
Revenue, Target, 12
Revenue, Achieved %, 13
GM, Target, 14
GM, Achieved %, 15
Strategic, Target, 16
Strategic, Achieved %, 17
];

UI Expression:
Pick(
Match(
ONLY(R1_Header & '|' & R2_Header),
'Actual Net Sell-In Revenue|Revenue',
'Actual Net Sell-In Revenue|GM',
'Actual Net Sell-In Revenue|GM%',
'Cross Border Adjustments|Revenue',
'Cross Border Adjustments|GM',
'Cross Border Adjustments|GM%'
),
Num($(vActNetSellInRev),'€ #,##0;-€ #,##0'),
Num($(vActNetSellInGM),'€ #,##0;-€ #,##0'),
3,
Num($(vPOSRev),'€ #,##0;-€ #,##0'),
Num($(vPOSGM),'€ #,##0;-€ #,##0'),
Num($(vPOSRev)/$(vPOSGM),'#,##0.00%')
)

The problem is 'vActNetSellInGM':

// Sell-In Adjusted Margin
Sum(
Aggr(
If(
Only(REASON_CODE) = 'Sales Order'
and
(
(
Sum({<LineType = {'ERP_Sales_In'}, EXCLUDED_SALE = {'N'}>} BASE_CURRENCY_VALUE)
-
(
Sum({<LineType = {'ERP_Sales_In'}, EXCLUDED_SALE = {'N'}>} LOGICAL_QUANTITY)
* Sum({<LineType = {'ERP_Sales_In'}, EXCLUDED_SALE = {'N'}>} SAP_AVG_INV_COST)
* ($(vVar%) / 100)
)
)
/
Sum({<LineType = {'ERP_Sales_In'}, EXCLUDED_SALE = {'N'}>} BASE_CURRENCY_VALUE)
) < 0.10,

Sum({<LineType = {'ERP_Sales_In'}, EXCLUDED_SALE = {'N'}>} BASE_CURRENCY_VALUE) * 0.10,

If(
Match(Only(REASON_CODE),
'PA CREDIT MEMO',
'Project Price Claim',
'REBATE',
'STOCK PROTECTIO',
'Target-Based Rebate',
'Manual Credit'
),

Sum({<LineType = {'ERP_Sales_In'}, EXCLUDED_SALE = {'N'}>} BASE_CURRENCY_VALUE),

(Sum({<LineType = {'ERP_Sales_In'}, EXCLUDED_SALE = {'N'}>} BASE_CURRENCY_VALUE)
-
(
Sum({<LineType = {'ERP_Sales_In'}, EXCLUDED_SALE = {'N'}>} LOGICAL_QUANTITY)
* Sum({<LineType = {'ERP_Sales_In'}, EXCLUDED_SALE = {'N'}>} SAP_AVG_INV_COST)
* ($(vVar%) / 100)
))
)
),

ERP_DeliveryRegion,
AdjustmentType,
INVOICE_SUB_TYPE,
REASON_CODE,
INVDATE,
INVOICE,
ITEM_ID
)
)

The header grouping is on REGION and REGION_GROUP, so AGGR() working in the Pivot table with R2 header whereas, the moment I introduce R1, its making it worse.

Can you please suggest how can I achieve this?

Business Formula: 
If (Margin < 10%, Sum(BCV), Sum(BCV) * 10%,
For some REASON_Code, Sum(BCV), Sum(BCV) - VC Cost)
Aggr () them on the granular fields. 


I will really appreciate any advice around this.

1 Solution

Accepted Solutions
Prads_PFUEAME
Contributor II
Contributor II
Author

Thank you so much for the response @robert_mika 
I took all the 4 dimensions in the Script and applied it under AGGR() in the Pivot expression and it worked.

View solution in original post

2 Replies
robert_mika

Not exactly a solution but maybe some cobination with valuelist may help

 

like

https://community.qlik.com/t5/Visualization-and-Usability/Pivot-table-using-ValueList-as-Rows/td-p/2...

Prads_PFUEAME
Contributor II
Contributor II
Author

Thank you so much for the response @robert_mika 
I took all the 4 dimensions in the Script and applied it under AGGR() in the Pivot expression and it worked.