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

SUM with 2 x IF

Hi,

I have a table with Dimension for customer & currency. I then have measures summing values (one for UK spend, one for GmbH spend).

We have a basic preset internal transaction exchange rate (say 1.2 for now).

I can convert the GBP using-

Sum ({<WAERK = {'GBP'}>}[ZDE_UMSATZ.NETWR]) + Sum ({<WAERK = {'GBP'}>}NETWR) * 1.2

(blacked out names).

Daryn_0-1650611874339.png

 

I then tried to turn the expression into a SUM IF. So that the last column 'Totals in €' will include the € currency values as they are ) no multiplication or such.

At some point I will look to include another IF for the $ currency values, but that hasn't got to be now!

WAERK = currency

ZDE_UMSATZ.NETWR = GmbH values

NETWR =  UK values

My currencies are as in the table 'GBP', 'EUR', 'USD'

I thought the below would be correct, but it isn't.

=SUM (IF (WAERK -= {'EUR'},[ZDE_UMSATZ.NETWR]+[NETWR]*1.2), IF (WAERK = {'EUR'},[ZDE_UMSATZ.NETWR]+[NETWR]))

I hope that makes sense! Thanks as always for any advice or solution. 

Happy Friday!

Regards, Daryn.

Labels (1)
6 Replies
brunobertels
Master
Master

Hi 

may be this 

=SUM (IF (WAERK -= {'EUR'},[ZDE_UMSATZ.NETWR]+[NETWR]*1.2), IF (WAERK = {'EUR'},[ZDE_UMSATZ.NETWR]+[NETWR]))

 

sum( if( WAERK<>'EUR', 

[ZDE_UMSATZ.NETWR]+[NETWR]*1.2),

if(WAERK='EUR' ,

ZDE_UMSATZ.NETWR]+[NETWR]))

 

Daryn
Creator
Creator
Author

Hi Bruno,

Thanks for responding 👍

Unfortunately that gives ;

Daryn_0-1650614351124.png

 

brunobertels
Master
Master

Hoi 

 

Sorry my bad 

so may be this 

 

IF(WAERK='EUR',SUM([ZDE_UMSATZ.NETWR]) + SUM([NETWR]),IF(WAERK<>'EUR',

SUM([ZDE_UMSATZ.NETWR])+SUM(NETWR]*1.2) ) 

Daryn
Creator
Creator
Author

Hi and again, thank you.

Unfortunately still an error (I can't see where though).

Daryn_0-1650619425314.png

 

brunobertels
Master
Master

IF(WAERK='EUR',SUM([ZDE_UMSATZ.NETWR]) + SUM([NETWR]),IF(WAERK<>'EUR',

SUM([ZDE_UMSATZ.NETWR])+SUM(NETWR]*1.2) ) 

Daryn
Creator
Creator
Author

Hi Bruno,

Again still an error. I can't see why though!

However following your guidance, I have it working with a nested IF:

IF (WAERK='EUR',SUM([ZDE_UMSATZ.NETWR]) + SUM([NETWR]),
IF (WAERK='GBP',SUM([ZDE_UMSATZ.NETWR]*1.2) + SUM([NETWR]*1.2)
)
)

Daryn_0-1650623596807.png

I can add another If for the USD.

Really appreciate your replies and guidance 👍, thank you.  Have a great weekend.