Calculating Percentage for a column in a List Component Dataset

I have the following query for a dataset:

select item, sum(salesAmount) as TotalSales from sales group by item order by TotalSales desc;

and I have set REPORT_COUNT<=5 for limiting the data to 5 records only. Now I want to display top 5 items through a list component and their Sales Amount in percentage to that of the TotalSales amount of the top 5 items. I have created a variable in the dataset as sales_sum

class: BigDecimal

Calculation : Sum

Reset Type : Report

Increment Type : None

Variable Expression : $F{TotalSales}

Now I am adding a text field and using expression $F{TotalSales}/$V(sales_sum) and set the evaluation time to Auto. But it is returning null and a NullPointerException What should I do? Thank you

pandit.sumit's picture
Joined: Jun 20 2014 - 6:31am
Last seen: 8 years 8 months ago

0 Answers:

No answers yet
Feedback
randomness