cancel
Showing results for 
Search instead for 
Did you mean: 

Supress Subtotal If the Columns under Group is less than 2

Former Member
0 Kudos

Hi Folks!!

I am facing this issue while formatting one of my Crystal Report.

Its having a Cross Tab  in which several Groups are there among them under Group "Year" let say I am having Column "C", And there a Subtotal Column which is showing total for column "C" for each value of Group "Year".

The requirement is the Subtotal Column should not be visible if the if Column "C" is having a single Record.

In the screenshot the first Subtotal "2016 Total" should not appear as only single record is there under year 2016.

Please help me to get this done..!!

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Prerna,

Would you be able send the report with 'saved data' to my e-mail (my e-mail is in my profile)?

It is much easier to apply logic on an actual crosstab report that trying to replicate it.

-Abhilash

Former Member
0 Kudos

Hi Abhilash,

I wish i could have but its on client network and i can't share it from there.

abhilash_kumar
Active Contributor
0 Kudos

Attached is a sample report that matches your requirement.

I haven't added as many columns as there are in your crosstab, however, the workaround is still the same.

1) Suppress the existing Subtotal from the Customize Crosstab tab

2) Insert a distinct Count summary on the Column 'C' in the crosstab and suppress it.

3) Insert a Calculated Column and name it 'Total'.

4) Edit its Insertion formula. You can see the formula I've added.

Download this zip file > Extract its contents > Change the extracted file's extension from .txt to .rpt.

-Abhilash

Former Member
0 Kudos

Hi Abhilash,

Thanks for you help!!

But I am not able to open the file, getting below error:

"The Compound file %1 is produced with a newer version of storage"

Tried to open it in CR-2013 and 2011 both.

Can you please paste the insertion formula here only?

Thanks,

Prerna

abhilash_kumar
Active Contributor
0 Kudos

Hi Prerna,

The just downloaded the file I attached and it works well for me.

Here are the steps again:

1) Download the file

2) Extract the .zip contents

3) You should see a file called 'Crosstab - Prerna.txt'. If you don't see the .txt extension, go to 'My Computer' > Press alt + T > Folder Options > View > Uncheck 'Hide extensions for known file types'

4) Go back to the folder you extracted the file.

5) 'Crosstab - Prerna.txt' to 'Crosstab - Prerna.rpt'

The Insertion formula alone will not work. You'd need to insert the summary I mentioned in Step 2 for this to work.

Here's the insertion formula anyway:

GetColumnGroupIndexOf(CurrentColumnIndex) = 1

AND GridValueAt(0, CurrentColumnIndex, 1) > 1

-Abhilash

Former Member
0 Kudos

It's done..

Thanks for you help and guidance Abhilash..:)

Answers (0)