This is a migrated thread and some comments may be shown as answers.

Finding a difference in a cross tab

5 Answers 101 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Yogesh
Top achievements
Rank 1
Yogesh asked on 20 Feb 2013, 03:56 AM
I am trying to find a difference between 2 values in the corss tab total by using iff and sum since there is no diff or subtract function. How do i do it. Not looking to do in code but in the designer itself using an expression.

5 Answers, 1 is accepted

Sort by
0
Massimiliano Bassili
Top achievements
Rank 1
answered on 20 Feb 2013, 08:19 AM
There is a "-" operator (Operators)
0
Yogesh
Top achievements
Rank 1
answered on 20 Feb 2013, 04:45 PM
Yes but my date is structured differently. This is what my sql query returns. And i when i make the crosstab query it gives me the total at the bottom as 150 which is fine, but i need a net meaning payment minus refund. I tried using iif condition to add anything that says payment and subtract anything that says refund, but no luck to create the difference. I want the subtotal to return 50 not 150. Please help.

Type                  Amount
Payment 100
Refund            50
0
Squall
Top achievements
Rank 1
answered on 20 Feb 2013, 04:53 PM

What expression you have used? I have done something similar:

= Sum(IIF(Fields.Label ="Refund", -Fields.Amount, Fields.Amount))

0
Yogesh
Top achievements
Rank 1
answered on 20 Feb 2013, 05:12 PM
I tried in 2 ways.
First one

=iff(Fields.Type='Payment', Sum(Fields.Amount,0))-iff(Fields.Type='Refund', Sum(Fields.Amount,0))

Second way
=sum(iif(Fields.Type='Payment', Fields.Amount,0)-sum(iif(Fields.Type='Refund', Fields.Amount,0)

And none of those syntax work... 

0
Peter
Telerik team
answered on 21 Feb 2013, 04:30 PM
Hi Yogesh,

Generally the suggested solution should work. Check out the attached sample, to run it you only have to copy the archived files in our report examples project, that came with your Telerik Reporting installation.

If you still experience any further difficulties we will appreciate if you open support thread and send us a runnable sample to review on our end.

Kind regards,
Peter
the Telerik team

See what's new in Telerik Reporting Q1 2013. Register for the March 4 webinar to witness the impressive new visualizations in Telerik Reporting. Just for fun, 10 webinar attendees will be randomly selected to win a Telerik T-shirt and a $50 Gift Certificate to ThinkGeek. Register now! Seats are limited!

Tags
General Discussions
Asked by
Yogesh
Top achievements
Rank 1
Answers by
Massimiliano Bassili
Top achievements
Rank 1
Yogesh
Top achievements
Rank 1
Squall
Top achievements
Rank 1
Peter
Telerik team
Share this question
or