Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Vince_CH
Creator III
Creator III

Qlik sense sum of multiplied two fields

Hello Community, 

as below,  i intend to multiply PUR_Price*PUR_Currency_1 and sum finally at KPI, however, the last column resulted in zero, and i looked at earlier posts in qlikview and also tried with following expressions, but all didn't work out on my qliksense, anyone can help ?? thanks!

11.jpg

  • PUR_Price*PUR_Currency_1
  • num(Sum(Aggr(PUR_Price,PUR_Order_Number,PUR_Order_Item,PUR_Material_Number)*Aggr(PUR_Currency_1,PUR_Order_Number,PUR_Order_Item,PUR_Material_Number)),'#.##')
  • num(Sum(Aggr(Sum(PUR_Price)*Sum(PUR_Currency_1),PUR_Order_Number,PUR_Order_Item,PUR_Material_Number)),'#.##')
  • num(Sum(Aggr((PUR_Price*PUR_Currency_1),PUR_Order_Number,PUR_Order_Item,PUR_Material_Number)),'#.##')
  • Sum(num(Aggr(PUR_Price,PUR_Order_Number,PUR_Order_Item,PUR_Material_Number),'#,##')*num(Aggr(PUR_Currency_1,PUR_Order_Number,PUR_Order_Item,PUR_Material_Number),'#.##'))
  • num(Sum(Aggr(PUR_Price,PUR_Order_Number,PUR_Order_Item,PUR_Material_Number)*Aggr(PUR_Currency_1,PUR_Order_Number,PUR_Order_Item,PUR_Material_Number)),'#.##')
38 Replies
Vince_CH
Creator III
Creator III
Author

It returns empty cells.
Vince_CH
Creator III
Creator III
Author

Hi All,
having tried, it seems following two returns with values, but in result like 76515 instead, what i expect is format like 7,6515 (comma is the decimal separator), how to correct?

Num(Num#([PUR_Currency_1], '#,####-', '.', ',')) AS [PUR_Currency_1],
Num(Num#(Replace([PUR_Currency_1],'-',''),'#,####')) AS [PUR_Currency_1],
jfkinspari
Partner - Specialist
Partner - Specialist

If case below doesn't work, it would perhaps be easier if you uploaded a sample app 🙂

Try

Num(Num#(Replace([PUR_Currency_1],'-',''),'#,####',',','.')) AS [PUR_Currency_1]
Vince_CH
Creator III
Creator III
Author

Dear ,

i used following to make it now, but the looking of decimal sepator are different compared with orignial version, one is dot, another is comma, seeing below, how to make them uniform?

Num(Num#([PUR_Currency_1], '#,####-', '.', ',')/10000,'#,####') AS [PUR_Currency_1],

11.jpg

Vince_CH
Creator III
Creator III
Author

Hi Jfkinspari, not sure if you know that qvf file is not be able to uploaded so far.
your formu works also, just the decimal separator is same like mine, in ".", different from looking of original ",".

also just i am confused about the meaning of ' , ' , ' . ' inside the expression?
jfkinspari
Partner - Specialist
Partner - Specialist

No I wasn't aware of any problems uploading .qvf files, but a solution is to zip the file before uploading

You can also look into the num#() and num() to understand how it interprets and format numbers in regards to comma and thousand seperator

timpoismans
Specialist
Specialist

That solution won't work either. Or it didn't work for me yesterday at least.

 

@Vince_CH
The difference between num#() and num() is the following:

Num# is used to change, if possible, a string to a number. The input is like (yournumberastext,'format of how you want your number','decimal seperator','thousand seperator')

 

Num works the same way as Num#, but takes a number as input, not a string.

 

The only field you need to have though, is:

For Num# you need a number as a string

For Num you need a number.

 

If you only use those parameters in the function, the format and seperators will go to default and should match the values showing in your application.

 

 

Regards,

Tim P.

Vince_CH
Creator III
Creator III
Author

Hi Tim, thanks for explaining in words, however, as i tried with the expression from Jfkinspari like: Num(Num#(Replace([PUR_Currency_1],'-',''),'#,####',',','.')) AS [PUR_Currency_1]
the decimal separator indicated actually is comma in ',' but also loading it appears to be '.' again in decimal position, ??
timpoismans
Specialist
Specialist

What does it give if you try the following:

Num#(Replace([PUR_Currency_1],'-',''))

This should default to the format of your app (the one that's set on the very first page of the script, all the variables being SET).

Vince_CH
Creator III
Creator III
Author

Hi Tim, it works, now the appearance look same, but the multiplied two fileds (PUR_Price*PUR_Currency_1) become zero.