Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
anwarbham
Contributor III
Contributor III

Qlik sense Function similar to SSAS SCOPE

Hi I have been looking though the qlik functions and i cant seem to find anything that can do a similar job as the Scope Function in SSAS

i have tried APPLYMAP but you cannot in my particular example this wont work.

i have also tried MATCH function Similar issue .

in SSAS i have the data model below that i have replicated  PNL_Facts to a PNL hierachy Table "Dimension".

 

but in SSAS there are a few accounts that are group accounts or calculated accounts.

these accounts do not exists in the PNL_Facts but do exist in the PNL hierachy Table "Dimension"

example  in SSAS

SCOPE ([PnL].[PnL line].&[8920000000],{[Measures].[Value Qty],[Measures].[Value Qty Fixed3],[Measures].[Value Qty Fixed4]}); 
this=([PnL].[PnL line].&[3081600000] +[PnL].[PnL line].&[3083116000]); 
End Scope; 

 

Account 8920000000 is an invented account that only exists on the  PNL hierachy Table "Dimension" its actually a calculation between 2 accounts 3081600000 + 3083116000 that do exist in the PNL_Facts 

the end result is example 

Actual FY Account CodeType of account No
18.6763260000000Real
12.6468910000000Invented 
-1.768920000000Real
124.198930000000Real
98.848950000000Invented

 

can this be done in Qlik 

the closest thing i have is this 

$(vActual_FY(pnl_code ={3081600000}))
+
$(vActual_FY(pnl_code ={3083116000}))

it gets me the total but as a separate column 

 

Labels (4)
1 Solution

Accepted Solutions
anwarbham
Contributor III
Contributor III
Author

i think i have achieved it via a template file i created in excel its not pretty 

i created an excel file in the format below with the row labels and account number some account numbers like 3260000000 exist in the PNL Fact table and some like 8920000000 dont  8920000000 is a group of accounts 

Row LabelsAccount CodeFormula 
IAT after Minority Interests32600000000 
Operating EBITA89100000001 
Divestments net89200000001 
EBITA (w/o Divestments)89300000001 
Sustainable IBT89500000001 
Operating EBITDA89600000001 
S-EBITDA89700000001 
Total Costs89800000001 
IBT before deprec. & amor.89900000001 
Marketing, Sales and Distribution costs90000000001 
Margin A190200000001 
Cost of Goods Sold variable90300000001 
Cost of Goods Sold fix90400000001 
Adjusted EBITDA90500000000 
Adjusted IBT90600000001 
    

 

This file loaded into Qlik via the script.

created a QLIk Table visualisation using the  [Row Labels]  asthe dimension 

and the measure is 

 

if(
[Account Code] = '8920000000',
$(vDivestments_net_Actual_FY),
if(
[Account Code] = '8980000000',
$(vTotal_Costs),$(vActual_FY(''))
))

 

the variables hold the measures example $(vDivestments_net_Actual_FY)

 

$(vActual_FY(pnl_code ={3081600000}))
+
$(vActual_FY(pnl_code ={3083116000}))

 

i might not get the granularity i want by using the hierarchy table but it works

Sin título.png

unless there is a better solution 

 

View solution in original post

3 Replies
lorenzoconforti
Specialist II
Specialist II

I think I understand what you are trying to achieve

When you say "it gets me the total but as a separate column", are you trying to implement this at a script level or on the front end? Do you only have one occurrence where you need to merge the two accounts or it's repeated for multiple entries?

It would be good if you could share more details of your Sense data structure and the visualization you are trying to create

anwarbham
Contributor III
Contributor III
Author

i think i have achieved it via a template file i created in excel its not pretty 

i created an excel file in the format below with the row labels and account number some account numbers like 3260000000 exist in the PNL Fact table and some like 8920000000 dont  8920000000 is a group of accounts 

Row LabelsAccount CodeFormula 
IAT after Minority Interests32600000000 
Operating EBITA89100000001 
Divestments net89200000001 
EBITA (w/o Divestments)89300000001 
Sustainable IBT89500000001 
Operating EBITDA89600000001 
S-EBITDA89700000001 
Total Costs89800000001 
IBT before deprec. & amor.89900000001 
Marketing, Sales and Distribution costs90000000001 
Margin A190200000001 
Cost of Goods Sold variable90300000001 
Cost of Goods Sold fix90400000001 
Adjusted EBITDA90500000000 
Adjusted IBT90600000001 
    

 

This file loaded into Qlik via the script.

created a QLIk Table visualisation using the  [Row Labels]  asthe dimension 

and the measure is 

 

 

 

if(
[Account Code] = '8920000000',
$(vDivestments_net_Actual_FY),
if(
[Account Code] = '8980000000',
$(vTotal_Costs),$(vActual_FY(''))
))

 

 

 

 

the variables hold the measures example $(vDivestments_net_Actual_FY)

 

 

 

$(vActual_FY(pnl_code ={3081600000}))
+
$(vActual_FY(pnl_code ={3083116000}))

 

 

 

i might not get the granularity i want by using the hierarchy table but it works

Sin título.png

unless there is a better solution 

 

anwarbham
Contributor III
Contributor III
Author

i think i have achieved it via a template file i created in excel its not pretty 

i created an excel file in the format below with the row labels and account number some account numbers like 3260000000 exist in the PNL Fact table and some like 8920000000 dont  8920000000 is a group of accounts 

Row LabelsAccount CodeFormula 
IAT after Minority Interests32600000000 
Operating EBITA89100000001 
Divestments net89200000001 
EBITA (w/o Divestments)89300000001 
Sustainable IBT89500000001 
Operating EBITDA89600000001 
S-EBITDA89700000001 
Total Costs89800000001 
IBT before deprec. & amor.89900000001 
Marketing, Sales and Distribution costs90000000001 
Margin A190200000001 
Cost of Goods Sold variable90300000001 
Cost of Goods Sold fix90400000001 
Adjusted EBITDA90500000000 
Adjusted IBT90600000001 
    

 

This file loaded into Qlik via the script.

created a QLIk Table visualisation using the  [Row Labels]  asthe dimension 

and the measure is 

 

if(
[Account Code] = '8920000000',
$(vDivestments_net_Actual_FY),
if(
[Account Code] = '8980000000',
$(vTotal_Costs),$(vActual_FY(''))
))

 

the variables hold the measures example $(vDivestments_net_Actual_FY)

 

$(vActual_FY(pnl_code ={3081600000}))
+
$(vActual_FY(pnl_code ={3083116000}))

 

i might not get the granularity i want by using the hierarchy table but it works

Sin título.png

unless there is a better solution