0

How to create variables in crystal reports? (not crystal report enterprise)

May 31, 2017 at 01:09 PM

195

Hi,

I wanna create a variable as below...

sum(sale) where country = india

sum(sale) where country <> 'USA

I wanna use these measures in crosstab table.

Ian Waterman May 31, 2017 at 01:23 PM
0

No need to use variables just create two formula

@India

If country = india then sales else 0

repeat for USA

This can then be used in Summaries or Crosstab

Ian

Show 1 Share

Hi,

I need India total sale and total sale except USA

not which you have given

Thanks

Riaz

Ido Millet May 31, 2017 at 02:23 PM
0

Simply insert a CrossTab with rows (or columns) being Country and the summarized value being Sales.

Show 1 Share

Hi,

I wanna use india sale in one column and another in another row.

Thanks

Riaz

Riaz Ahmed May 31, 2017 at 03:20 PM
0

I want as below....

Where sale is a measure object. I wanna calculate india sale and other countries sale and use it.

Thanks

Riaz

question.jpg (11.5 kB)
Show 3 Share

Slight variation

Create formula

@country

If Country <> 'India' then 'Other' else 'India'

Then as Ido said use this formula as your crosstab column and then sum sales as summary of you category field

Ian

Select filter exclude USA from data

Hi,

I have created formula as you said

if country in( 'india';'russia') then 'asia'

else others

I used that formula in crosstab. But I didn't get the sum of both coutries. I'm getting only russia value.

Ian Waterman May 31, 2017 at 04:15 PM
0

Can you show syntax as written in Crystal

separator in a list should be , you appear to have used ;

If syntax correct it should work.

failing that split out to make sure you have india data

if country = 'india' then 'india'

else if country = 'russia' then 'Russia'

else 'others'

Ian

Show 3 Share

if {Country} in ('India';'Russia')

then 'Asia'

else others

for this I should get india+russia sale right but I'm getting Russia sale only

above is the exact formula I used in crystal

Thanks

Riaz

If I use , it is not accepting. it is accepting ; only

Never seen this before. Your logic is correct except for use of round brackets an ;

I would write as

if {Country} in ['India','Russia']

then 'Asia'

else 'others'

that is using square brackets, with comma separator. Also Others must be wrapped in speech marks