Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
sona_sa
Creator II
Creator II

Logic Help

Option1:
Load * Inline [
Option1
Million (Means will display the value in M)
Full Value (Means will display the value in Integer)
];

Option2:
Load * Inline [
Option2
'1 M $'
'2 M $'
'3 M $'
];

Now I have to make an expression for calculation on - 

If I select Option1 = 'Million ' and Option2 = '1M$' Then I want the sum of Non_PTI, Where Value will be in Million which is Greater Then 1M

If I select Option1 = 'Million ' and Option2 = '2M$' Then I want the sum of Non_PTI, Where Value will be in Million which is Greater Then 2M

If I select Option1 = 'Million ' and Option2 = '3M$' Then I want the sum of Non_PTI, Where Value will be in Million which is Greater Then 3M

For -->  sum({<account={'EXPENSE'}>}non_ pti)

Else Full Value in Integer. like --> 20000000000.25614

Can anyone make an expression with these 2 condition  for me.

Regards,

AK

Labels (2)
11 Replies
Vegar
MVP
MVP

You could solve it like this. Please see my attached qvf.

51e2b79f-6d0c-472b-a922-460ff1415ffa.gif

sona_sa
Creator II
Creator II
Author

Thanks Vegar For Quick Solution.

Here for Full Value selection, It is not coming in full integer value. Like - 2.5 M (Full Value Means - 2500000)

Also one small doubts, is it work on Table, the same function.

Thanks Again.

AK

sona_sa
Creator II
Creator II
Author

Hi Vegar I am trying to do the same, But Not Coming in Straight Table.

I am using 3 List box for the same.

Option1:
Load * Inline [
Option1
Million (Means will display the value in M)
Full Value (Means will display the value in Integer)
];

Option2:
Load * Inline [
Option2
'1 M $'
'2 M $'
'3 M $'
];

Option3:
Load * Inline [
Option3
Yes
No
];

If I select Option1 = 'Million ' and Option2 = '1M$' and Option3 = 'No'Then I want the sum of Non_PTI, Where Value will be in Million which is Greater Then 1M

If I select Option1 = 'Million ' and Option2 = '2M$' and Option3 = 'No'Then I want the sum of Non_PTI, Where Value will be in Million which is Greater Then 2M

If I select Option1 = 'Million ' and Option2 = '3M$' and Option3 = 'No' Then I want the sum of Non_PTI, Where Value will be in Million which is Greater Then 3M

For -->  sum({<account={'EXPENSE'}>}non_ pti)

Else Full Value in Integer. like --> 20000000000.25614

Can You make an expression with these 3 condition  for me. 

Please do the needful.

AK

 

sona_sa
Creator II
Creator II
Author

Hi Vegar,

For Option3 - In Script What I need to do, Whatever We have done for Option1 and Option2 (Dual Function)

and

I am using for the same -->

(if(GetFieldSelections(Option3)='No', sum({<sub_account={'EXPENSE_TYPE'}>}non_controllable_pti)/min(Option1),
sum({<sub_account={'EXPENSE_TYPE'}>}non_controllable_pti_ex_cc)/min(Option1)))

Full Value in Integer. like --> 20000000000.25614 and IS it possible in Table?

It will work or not.

Regards,

AK

 

sona_sa
Creator II
Creator II
Author

Hi Vegar,

I have used the same for my QVF. Below is my script :-->

Option1:
Load dual(Option1,Num) as Option1 Inline [
Option1, Num
Million (Means will display the value in M), 1000000
Full Value (Means will display the value in Integer), 1
];

Option2:
Load dual(Option2,Num) as Option2 Inline [
Option2, Num
'1 M $', 1000000
'2 M $',2000000
'3 M $',3000000
];

Option3:
Load dual(Option3,Num) as Option3 Inline [
Option3, Num
Yes
No
];

Now I want to use the same expression -->Sum({<Accout={'EXPENSE'}>}non_pti)/min(Option1)

In my expression -->

(if(GetFieldSelections(Option3)='No', sum({<sub_account={'EXPENSE_TYPE'}>}non_controllable_pti)/min(Option1),
sum({<sub_account={'EXPENSE_TYPE'}>}non_controllable_pti_ex_cc)/min(Option1)),

if(GetFieldSelections(Option3)='No', sum({<sub_account={'EXPENSE_TYPE'}>}non_controllable_pti), sum({<sub_account={'EXPSENSE_TYPE'}>}non_controllable_pti_ex_cc)))

It is not working.

Regards,

AK

Vegar
MVP
MVP

OK, 

try this updated version 

image.png

sona_sa
Creator II
Creator II
Author

I Created for the same with this help of this :-

But not working :-

Options1:
Load dual(Options1,Num) as Options1 Inline [
Options1, Num
Millions, 1000000
Full value, 1
];

Options2:
Load dual(Options2,Num) as Threshold Inline [
Options2, Num
'1 M $', 1000000
'2 M $', 2000000
'3 M $', 3000000
];

Option3:
Load * Inline [
Option3, Option3.Table
Yes, non_controllable_pti_ex_cc
No, non_controllable_pti
Yes, controllable_pti_ex_cc
No, controllable_pti,
Yes, fee_spread_ex_cc
No, fee_spread
Yes, transfer_price_ex_cc
No, transfer_price
];


IF(GetFieldSelections(roundingOptions)='Millions',IF(GetFieldSelections(IFrsOptions)='No',sum({<sub_account={'EXPENSE_TYPE'}>}non_controllable_pti)/min(Options1),sum({<sub_account={'EXPENSE_TYPE'}>}non_controllable_pti_ex_cc)/min(Options1)),
IF(GetFieldSelections(IFrsOptions)='No',sum({<sub_account={'EXPENSE_TYPE'}>}non_controllable_pti),sum({<sub_account={'EXPSENSE_TYPE'}>}non_controllable_pti_ex_cc))),

IF(GetFieldSelections(roundingOptions) ='Millions',IF(GetFieldSelections(IFrsOptions) = 'No', Sum({<sub_account={'EXPENSE_TYPE'}>}controllable_pti)/min(Options1), Sum({<sub_account={'EXPENSE_TYPE'}>}controllable_pti_ex_cc)/min(Options1)),
IF(GetFieldSelections(IFrsOptions)='No',sum({<sub_account={'EXPENSE_TYPE'}>}controllable_pti),sum({<sub_account={'EXPENSE_TYPE'}>}controllable_pti_ex_cc))),

IF(GetFieldSelections(roundingOptions)='Millions',IF(GetFieldSelections(IFrsOptions)='No',Sum({<sub_account={'EXPENSE_TYPE'}>}cost_plus)/min(roundingOptions), (Sum({<sub_account={'EXPENSE_TYPE'}>}cost_plus_ex_cc)/min(Options1)),
IF(GetFieldSelections(IFrsOptions)='No', Sum({<sub_account={'EXPENSE_TYPE'}>}cost_plus), Sum({<sub_account={'EXPENSE_TYPE'}>}cost_plus_ex_cc))),

IF(GetFieldSelections(roundingOptions)='Millions', IF(GetFieldSelections(IFrsOptions)='No',SUM({<sub_account ={'EXPENSE_TYPE'}>}fee_spread)/min(Options1), (SUM({<sub_account ={'EXPENSE_TYPE'}>}fee_spread_ex_cc)/min(Options1)),
IF(GetFieldSelections(IFrsOptions) = 'No',sum({<sub_account ={'EXPENSE_TYPE'}>}fee_spread), sum({<sub_account ={'EXPENSE_TYPE'}>}fee_spread_ex_cc))),

IF(GetFieldSelections(roundingOptions)='Millions', IF(GetFieldSelections(IFrsOptions) = 'No', SUM({<sub_account = {'EXPENSE_TYPE'}>}transfer_price)/min(Options1), (SUM({<sub_account = {'EXPENSE_TYPE'}>}transfer_price_ex_cc)/min(Options1)),
IF(GetFieldSelections(IFrsOptions)='No',sum({<sub_account = {'EXPENSE_TYPE'}>}transfer_price),sum({<sub_account = {'EXPENSE_TYPE'}>}transfer_price_ex_cc)))

 

Can you help on the same.

Regards,

AK

sona_sa
Creator II
Creator II
Author

Hi Vegar,

Below is data, Can you make the same expression : In the previous attached updated version.

IF(GetFieldSelections(roundingOptions)='Millions',IF(GetFieldSelections(IFrsOptions)='No',Sum({<sub_account={'EXPENSE_TYPE'}>}cost_plus)/min(roundingOptions), (Sum({<sub_account={'EXPENSE_TYPE'}>}cost_plus_ex_cc)/min(roundingOptions)),
IF(GetFieldSelections(IFrsOptions)='No', Sum({<sub_account={'EXPENSE_TYPE'}>}cost_plus), Sum({<sub_account={'EXPENSE_TYPE'}>}cost_plus_ex_cc))),

IF(GetFieldSelections(roundingOptions)='Millions', IF(GetFieldSelections(IFrsOptions) = 'No', SUM({<sub_account = {'EXPENSE_TYPE'}>}transfer_price)/min(roundingOptions), (SUM({<sub_account = {'EXPENSE_TYPE'}>}transfer_price_ex_cc)/min(roundingOptions)),
IF(GetFieldSelections(IFrsOptions)='No',sum({<sub_account = {'EXPENSE_TYPE'}>}transfer_price),sum({<sub_account = {'EXPENSE_TYPE'}>}transfer_price_ex_cc)))

Sub_AccountCost_PlusCost_Plus_CCtransfer_pricetransfer_price_ex_ccYearMonth
Expense30000000578300000179506000.92735920002019Jan
Expense31000000624100000179507000274559000.32019Feb
Expense34100000782400000.9199181000280056000.72019Mar
Expense34500000796700000.1204975000.3302410000.42019Apr
Expense34800000.98928000000206196000.7302797000.42019May
Expense54300000947600000231799000325057000.52018Jan
Expense54700000.211023800000237569000.7325777000.12018Feb
Expense570000001027500001250111000.5372404000.42018Mar
Expense608000001063600000272898000.2388108000.42018Apr
sona_sa
Creator II
Creator II
Author

Hi Vegar, Below is data and expression : can you convert the same logic in your updated qvf,

IF(GetFieldSelections(roundingOptions)='Millions',IF(GetFieldSelections(IFrsOptions)='No',Sum({<sub_account={'EXPENSE_TYPE'}>}cost_plus)/1000000, (Sum({<sub_account={'EXPENSE_TYPE'}>}cost_plus_ex_cc)/1000000),
IF(GetFieldSelections(IFrsOptions)='No', Sum({<sub_account={'EXPENSE_TYPE'}>}cost_plus), Sum({<sub_account={'EXPENSE_TYPE'}>}cost_plus_ex_cc))),

IF(GetFieldSelections(roundingOptions)='Millions', IF(GetFieldSelections(IFrsOptions) = 'No', SUM({<sub_account = {'EXPENSE_TYPE'}>}transfer_price)/1000000, (SUM({<sub_account = {'EXPENSE_TYPE'}>}transfer_price_ex_cc)/1000000),
IF(GetFieldSelections(IFrsOptions)='No',sum({<sub_account = {'EXPENSE_TYPE'}>}transfer_price),sum({<sub_account = {'EXPENSE_TYPE'}>}transfer_price_ex_cc)))

Sub_AccountCost_PlusCost_Plus_CCtransfer_pricetransfer_price_ex_ccYearMonth
Expense30000000578300000179506000.92735920002019Jan
Expense31000000624100000179507000274559000.32019Feb
Expense34100000782400000.9199181000280056000.72019Mar
Expense34500000796700000.1204975000.3302410000.42019Apr
Expense34800000.98928000000206196000.7302797000.42019May
Expense54300000947600000231799000325057000.52018Jan
Expense54700000.211023800000237569000.7325777000.12018Feb
Expense570000001027500001250111000.5372404000.42018Mar
Expense608000001063600000272898000.2388108000.42018Apr

 

Please do the needful.

Thanks & Regards,

AK