Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
BrianDH
Creator II
Creator II

Compare 2 values (formatted)

I need to compare two number fields.  One number comes to me as #,### the other #,###.## So I also need to format these to read the same.

 

if (num((Sum(BUDGET_AMT) / count(PROJECT_ID)), '#,###,###,#00') <> num(Sum(BH_AMOUNT_BUD), '#,###,###,#00'),MasterKey)

No error and way too many results. 

 

Labels (1)
1 Solution

Accepted Solutions
marcus_sommer
MVP
MVP

To format a number doesn't changed the value. This means - if this kind of adjustment is really needed for your data/results - you need to convert them - maybe per num#() - or to cut them - maybe per left/right/mid() or (probably more suitable) to round them - per round/floor(ceil(). I think I would use something like this:

if(floor(Sum(BUDGET_AMT) / count(PROJECT_ID)) - floor(Sum(BH_AMOUNT_BUD)), MasterKey)

You might need to use a different rounding-function and/or specifying the needed number of digits for it.

- Marcus

View solution in original post

3 Replies
felipessj
Contributor III
Contributor III

A question.

Do those numbers come in a number format (if you multiply them by 1 gives you the same number)?

If so, you should not have problems comparing them. 1,234 = 1,234.00 -> true.

if they come as text,

you should delete the characters that make the separation of thousands and pass it to decimal with the format you want

marcus_sommer
MVP
MVP

To format a number doesn't changed the value. This means - if this kind of adjustment is really needed for your data/results - you need to convert them - maybe per num#() - or to cut them - maybe per left/right/mid() or (probably more suitable) to round them - per round/floor(ceil(). I think I would use something like this:

if(floor(Sum(BUDGET_AMT) / count(PROJECT_ID)) - floor(Sum(BH_AMOUNT_BUD)), MasterKey)

You might need to use a different rounding-function and/or specifying the needed number of digits for it.

- Marcus

BrianDH
Creator II
Creator II
Author

Rounding that is the ticket!  Thanks!