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

Can I have 2 different number formats in 1 column in Qlik Sense

Hi,

I have this table:

ItemCurrencyPrice
AUSD250,00
AUSD250,00
BEUR180,00
BEUR180,00
CUSD100,00
CUSD100,00
DEUR80,00
DEUR80,00
DEUR80,00

In Qlik Sense I want it to look like this:

ItemPrice
A$ 500,00
B€ 360,00
C$ 200,00
D€ 240,00

Is that possible?

Now I have everything in $ or everything in €.

I tried formula's like if( Currency = USD, Price in $, Price in €) but nothing is working.

So I am wondering if it's possible at all.

Else I will use a Pivot Table and split the column in USD and EUR.

(I don't want to use a currency conversion table.)

I also have a table like this:

ItemMinus or PlusPrice
AMinus10,50
BPlus12,60
CPlus18,00
DMinus25,95
EPlus60,05

In Qlik Sense I want it to look like this:

ItemPrice
Totall54,20
A- 10,50
B12,60
C18,00
D-25,95
E60,05

So if the Item is a expense I want it to be calculated as a minus amount.

And if it is a income I want it to be calculated as a plus amount.

Is that possible?

1 Solution

Accepted Solutions
sll
Employee
Employee

Here is a script I wrote quickly. Accomplishes the same thing as above, just differently:

Price:

LOAD [Item],

  replace((replace(([Currency]&' '&[Price]), 'USD','$')), 'EUR','€')  as FinalPrice

FROM [lib://test/Book1.xlsx]

(ooxml, embedded labels, table is Sheet1);

Asim

View solution in original post

13 Replies
robert_mika
Master III
Master III

Your first question:

if(Currency='USD','$'&sum( Price),'€'&sum(Price))

Bear in mind that this become now a string not number!

EDIT:

if(Currency='USD',num(sum( Price),'$#,##0'),num(sum( Price),'€#,##0'))

Feeling Qlikngry?

How To /Missing Manual(18 articles)

sll
Employee
Employee

Here is a script I wrote quickly. Accomplishes the same thing as above, just differently:

Price:

LOAD [Item],

  replace((replace(([Currency]&' '&[Price]), 'USD','$')), 'EUR','€')  as FinalPrice

FROM [lib://test/Book1.xlsx]

(ooxml, embedded labels, table is Sheet1);

Asim

ogster1974
Partner - Master II
Partner - Master II

Second Question

if([Minus or Plus]='Plus',Price,0-Price)

robert_mika
Master III
Master III

For the second question:

if([Minus or Plus]='Minus',-sum( Price),sum( Price))

Anonymous
Not applicable
Author

Thanks, it's working!

Anonymous
Not applicable
Author

Thanks for your reaction, unfortunately it's not working.

robert_mika
Master III
Master III

Works for me:

Capture.PNG

Anonymous
Not applicable
Author

It's working, I made it an dimension in stead of a measurement...

Thanks!

Anonymous
Not applicable
Author

Can I ask you another question?

If I have an extra column, is it also possible to include that in the formula?

As you can see the field Curr & Price is with your formula and that's the same as the field Price so that's working good.

I also like to have the field Purchased Value in $ and €.

The field Purchased Value is already a formula:

Sum([Purchased Unit Qty]*Price)

So I made a new formula for the field Pur Val & Curr:

if(Currency='USD',num(Sum([Purchased Unit Qty]*Price), '$#,##0'),num(Sum([Purchased Unit Qty]*Price), '€#,##0'))

But that is not working...

Currency.jpg