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

Problem with expression (double if)

Hi,

Currently I am making an expression where the "default values" must be both Euro & RY (Rolling year). This expression works:

=if(vCurrency = 'EUR' and GetSelectedCount(MonthYear) = 0,
num(
        sum({< RY = {'1'}>}[#LinetotAfterDiscount]),
         only( {< CurrencyCode = {'EUR'} >} CurrencyFormat0Decimals)),
num(
        (sum( {< CURRID = {$(vCurrency)} >} [#LclLinetotAfterDiscount]) + sum( {< CURRID -= {$(vCurrency)} >}[#LinetotAfterDiscount] / $(vCurrency))),
        only( {< CurrencyCode = {$(vCurrency)} >} CurrencyFormat0Decimals)
)
)

 

When a currency other than euro is selected, it automatically moves to the bottom half of the expression.

The problem: RY is not included in the bottom half.

The question: How can I make the expression work so that when I select another currency but don't select monthyear, I still keep the RY but see the selected currency?

--> if I make a selection on MonthYear, it needs to show the selection. Not RY

 

Labels (2)
1 Solution

Accepted Solutions
hansvillo
Contributor III
Contributor III
Author

Problem solved!

 

New code:

if(GetSelectedCount(MonthYear) = 0,
if(vCurrency = 'EUR',
num(
sum({< RY = {'1'}>}[#LinetotAfterDiscount]),
only( {< CurrencyCode = {'EUR'} >} CurrencyFormat0Decimals)),
num(
(sum( {< CURRID = {$(vCurrency)},RY = {'1'}>} [#LclLinetotAfterDiscount]) + sum( {< CURRID -= {$(vCurrency)}, RY = {'1'}>} [#LinetotAfterDiscount] / $(vCurrency))),
only( {< CurrencyCode = {$(vCurrency)} >} CurrencyFormat0Decimals)
)
),
num(
(sum( {< CURRID = {$(vCurrency)} >} [#LclLinetotAfterDiscount]) + sum( {< CURRID -= {$(vCurrency)} >} [#LinetotAfterDiscount] / $(vCurrency))),
only( {< CurrencyCode = {$(vCurrency)} >} CurrencyFormat0Decimals)
)
)

View solution in original post

1 Reply
hansvillo
Contributor III
Contributor III
Author

Problem solved!

 

New code:

if(GetSelectedCount(MonthYear) = 0,
if(vCurrency = 'EUR',
num(
sum({< RY = {'1'}>}[#LinetotAfterDiscount]),
only( {< CurrencyCode = {'EUR'} >} CurrencyFormat0Decimals)),
num(
(sum( {< CURRID = {$(vCurrency)},RY = {'1'}>} [#LclLinetotAfterDiscount]) + sum( {< CURRID -= {$(vCurrency)}, RY = {'1'}>} [#LinetotAfterDiscount] / $(vCurrency))),
only( {< CurrencyCode = {$(vCurrency)} >} CurrencyFormat0Decimals)
)
),
num(
(sum( {< CURRID = {$(vCurrency)} >} [#LclLinetotAfterDiscount]) + sum( {< CURRID -= {$(vCurrency)} >} [#LinetotAfterDiscount] / $(vCurrency))),
only( {< CurrencyCode = {$(vCurrency)} >} CurrencyFormat0Decimals)
)
)