Skip to Content
0

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

May 31, 2017 at 01:09 PM

177

avatar image

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.

how to create these. please help me

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

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
10 |10000 characters needed characters left characters exceeded

Hi,

I need India total sale and total sale except USA

not which you have given

Thanks

Riaz

0
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
10 |10000 characters needed characters left characters exceeded

Hi,

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

Thanks

Riaz

0
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
10 |10000 characters needed characters left characters exceeded

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

0

Select filter exclude USA from data

0

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.

0
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
10 |10000 characters needed characters left characters exceeded

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

0

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

0

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

0