
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
to many decimals that can't be removed?
Hi,
I'm strugguling with a decimal-problem. In my source data i have numbers with 2 decimals (source data is an xml-file and i have checked it a 100 times, only 2 decimals). ok.
In my senario i store one of these numbers as a variable and then in one of my chart i want to color cells according to weather or not the number is higer, lower or equals that variable number. Piece of cake i thougt. But. if i subtract my set analysis statment (which contains numbers from the same field the variable is from) from the variable i end up with a differ.
I've attaced my chart (straight table) so that you can see the expresssion.
I've tried everything so that's why i need you guys.
Thanks!
- « Previous Replies
-
- 1
- 2
- Next Replies »
Accepted Solutions


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Annika
Use fabs() and check against a reasonable limit, see below.
See the attached qvw.
I changed the background color, and text color of the first column, to test. It works as far as I can see.
This is the Background Color expression:
if(fabs(sum({$<timename={'3 mån'}>} rate)-$(SBAB3mån))<0.0001, Yellow(),
if(sum({$<timename={'3 mån'}>} rate)>0,
if(sum({$<timename={'3 mån'}>} rate)>$(SBAB3mån), green(), red()), white())
)
hth/gg

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
go to chart properties>number->check radio Fix to-> type 2
or
you can use
num(Expression,'#.##')
hope this helps u

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
nope. none of them work. i still get "-0.00" in the subtraction.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i've tried the roundfunction tow but i don't know how to write that one when you want to round to two decimals. the example only shows one.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
can u share sample

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
here you go


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Annika
Round works like this:
(I am using pi() in the samples below which gives the value of pi as the number to round)
To round to four decimals:
round(pi(), 0.0001)
to round to three decimals:
round(pi(), 0.001)
to round to two decimals:
round(pi(), 0.01)
and so on.
I suggest you apply the rounding in the load script already.
hth/gg

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks!
but when i do this, my variables doesn't work for some reason.
this is what the previous table looks like after rounding:
as you can se, the header "4,12" is the variable but i doesn't show on the other rows as it did before. why is that?
I make this variable with the peek function.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No idea Annika.
Publish the new qvw, containing that table, and I can have a look
/gg

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
here it is

- « Previous Replies
-
- 1
- 2
- Next Replies »