I am working on pentaho report designer
HereI created one cross tab report. When I preview the report it is showing me results as below
name total
A 598.00
B 273.00
c 124.00
d 0.23
e 0.23
f 0.00
g 273.00
In the above results I want only the particular values should look in decimal format
Like I want only o.23 in the above result look like in decimal format and all the other I want to look like integer with out any decimal portions.
Is there any expression I can write.
Thanks in advance
In Pentaho report designer, you must define a data type for your inputs(https://www.screencast.com/t/y440gotpnp). The case that you describe could be treated with a formula(check the floating numbers e.g. different to "00" ... ) and as an output data type you could use a string(text)
Maybe you should use Truncate function inside you query, something like truncate(total,2), this will keep 2 digits after the ',' and if your totals end with 00 they won't be shown automatically.
Related
I'm trying to find a solution in datastage (Or in SQL) - without having to use a bunch of if/else conditions - where I can map value of one column based on value of another column.
Example -
Source File -
ID
Header1
Value1
Header2
Value2
1
Length
10
Height
15
2
Weight
200
Length
20
Target Output -
ID
Length
Height
Weight
1
10
15
2
20
200
I can do this using Index/Match function of excel. Was wondering if datastage or Snowflake can look into all these fields similarly and automatically populate the value column to the corresponding header column!
I think the best solution in DataStage would be a Pivot stage followed by a Transformer stage to strip out the hard-coded source column names.
I searched a lot, but didn't find an answer to the following question:
Financial data often come as daily data but with missing dates (weekends, banking holidays ...). I would like to have those data really on a daily basis with missing values, where originally the dates were missing.
So far I did this in liberoffice-calc half-manually, which takes a lot of time. I didn't find ways to really automate this, as there is no fixed rule, which dates are missing.
Example:
I have:
21/12/18 1
27/12/18 2
28/12/18 3
02/01/19 4
I want:
21/12/18 1
22/12/18
23/12/18
24/12/18
25/12/18
26/12/18
27/12/18 2
28/12/18 3
29/12/18
30/12/18
31/12/18
01/01/19
02/01/19 4
I'm not familiar with liberoffice-calc. In Excel or Google Sheets, I would use a lookup table.
In one tab of the spreadsheet, I was enter the dates I want in column A. In another tab, I would place the actual data I have. Then, in column B of the first tab, I would lookup the value for that day from the data on the second tab.
Assuming 1 is in B2, put a start date in say D2 and in E2:
=IFERROR(INDEX(B:B,MATCH(D2,A:A,0)),"")
then copy both down to suit.
Hi I have a table column named "sku" which of type integer and another column "total_sku" which again is of type integer , when I'm trying to calculate the percentage(100 * sku/total_sku) using Calculator step. I'm expecting an integer but its giving me 0.00 , kindly help
Thanks in advance.
sku total_sku percentage
23 2115 1.087
40 2115 1.891
My guess is that the calculator is doing the division before the multiplication, computing 100*(A/B), rather than (100*A)/B. Since you are dealing with integers, it is rounding A/B down to zero, and that is the end of it for you.
The calculator step lets you break a calculation down into multiple smaller components, all within the step. You can even specify which fields created in those substeps should stay in the stream, and which should are temporary values that should be discarded.
So try first doing a calculation such as tempValue = 100*A, then result = tempValue/B. Set Value type to Integer in both steps.
In the Calculator step, put 'Value type' as 'Integer'
I have a table in Qlikview with 2 columns:
A B
a 10
b 45
c 30
d 15
Based on this table, I have a formula with full acumulation defined as:
SUM(a)/SUM(TOTAL a)
As a result,
A B D
b 45 45/100=0.45
c 30 75/100=0.75
d 15 90/100=0.90
a 10 100/100=1
My question is. how do I mark in colour the values in column A that have on column D <=0.8)?
The challenge is that D is defined with full accumulation, but if I reference D in a formula, it doesn't consider the full accumulation!
I tried with defining a formula E=if(D>0.8,'Y','N') but this formula doesn't take the visible (accumulated) value for D unfortunately, instead it takes the D with no accumulation. If this worked, I would have tried to hide (not disable) E and reference it from the dimensions column of the table , Text colour option. Any ideas please?? Thanks
You can't get an expression column's value from within a dimension or it's properties, because the expression columns rely on the dimensions provided. It would create an endless loop. Your options are:
Apply your background colour to the expression columns, not the dimensions. This would actually make more sense as the accumulated values would have the colour, not the dimension.
When loading this specific table, have QlikView create a new column that contains the accumulated values of B. This would mean, however, that the order of your chart-table would need to be fixed for the accumulations to make any sense.
Use aggregation to create a temporary table and accumulate the values using RangeSum(). Note this will only accumulate properly if the table is ordered in Ascending order of Column A
=IF(Aggr(RangeSum(Above(Sum(B),0,10)),A)/100>0.8,
rgb(0,0,0),
rgb(255,0,0)
)
I have a float field which shows data as such:
1
1.00
3.12
3.00
I also have a varchar field that shows as such:
NA
ND
I
Data is as such: Fld_N is a float and Fld_S is varchar
Fld_N Fld_S
----- ------
1
ND
1.00
3.12
3
NA
I
Notice that a row can have a value for either the Fld_N or the Fld_S but not both.
What I am doing is using the coalesce as such:
COALESCE(STR(Fld_N,9,2), Fld_S) Fld
This doesn't quite work well as I have the decimal points always be upto 2 decimal points whereas I need it to support showing 1 as well as 1.00. Is there a way to not specify the decimal points and still accomomdate for showing 1 and 1.00 in my example?
try the convert function:
coalesce(convert(varchar,Fld_N),Fld_S) Fdl
Instead of STR, use
CAST(fld_N AS VARCHAR(9))
The VARCHAR will only use as many decimal places as necessary to show the value you provide.
Putting that into your COALESCE will yield:
COALESCE(CAST(fld_N AS VARCHAR(9)), Fld_S) AS Fld
In a float type column, there is absolutely no difference between 1 and 1.00. Therefore, what you suggest is actually impossible. The data stored in your database for rows 1 and 3 are, in reality, identical.
However, you can cast to VARCHAR instead of using STR, which will use the least number of decimal places necessary:
COALESCE(CAST(fld_N AS VARCHAR(12)), Fld_S) AS Fld
This should produce:
Fld
-----
1
ND
1
3.12
3
NA
I