Quantcast
Channel: Pentaho Community Forums
Viewing all articles
Browse latest Browse all 16689

Dividing two columns from a sql query

$
0
0
Hi everybody,

This is a silly question, but I'm rather new to Kettle transformations and I'm struggling to find the way to do this.

Let's say I have a table with my sales and their date. I want to know the increase in sales in % by year. In fact, I want to use that value to populate a dial chart in a CDE dashboard.

So, in Kettle I use two table inputs with two queries (like select 'sum(sales) from mysales where year=2014'). One of them gives me the value of the sales in this year and the other in the previous one. Since I'm using a sum(), I just have one value from each query. I understand that for Kettle it's still a table, even if it has just one row and one column, but I don't know how to extract a value from a query result in Kettle.

Now I'd just want to divide one by the other. I've read about the Calculator step, but it gives me errors (Calculator.0 - Unable to find the second argument field), and I think I'm not using it correctly.

I guess I could use the Set Variable step, but then I'd need to use another transformation to get the results, and I'm not sure I can use that (a job) within a CDE dashboard.

I'm not sure if this kind of things should be done with Kettle or not. I'm a beginner, so I'd appreciate if someone could point me in the right way.

Any help will be very appreciated, thanks!

Viewing all articles
Browse latest Browse all 16689

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>