We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Need to dynamically group by

kalittaair
kalittaair asked
on
Medium Priority
493 Views
Last Modified: 2012-05-11
Experts:

Using SSRS 2008.

I have a dataset containing 2 columns of data, Vendor and State. The same vendor can be in multiple states and states can of course contain multiple vendors. I want to group the report by either vendor or state, depending on which the user selects.

I set up a visible parameter called GrouBy. The valid choices for this parameter are "Vendor" or "State". The default is "Vendor".

I have a 2 column table displaying Vendor and State. I created a parent group by right clicking and add group>parent group. In the expression for the parent group I have the following:
=IIF(Parameters!GroupBy.value=”Vendor”, Fields!Vendor.Value, Fields!State.Value)

When I preview the report I get the error: "The Group expression used in grouping 'Group1' returned a data type that is not valid'

Any idea what I'm doing wrong?
Comment
Watch Question

Alpesh PatelSolution Architect at TCS (SAFe®Agilist, TOGAF® Foundation, PSM I®, MCP, MCSD)
CERTIFIED EXPERT

Commented:
Should be same DataType of both Vendor and State filed.

Author

Commented:
What should be? Do I somehow set the DataType of the group expression? How? Vendor and State are both Feilds being returned from my stored proc.

Thanks.
Sr. BI  Developer
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Jason - Thanks for the suggestion. I tried it and get the same error.

You want me to post my results from my SP? Basically the list of vendors and locations?

Jason YousefSr. BI  Developer

Commented:
just an example, not the actual data to get an idea,and also to try to build my test table.

Thanks

Author

Commented:
OK, A good example might be:

Vendor                      State
Acme                         Texas
Joe's                           Florida
Brother's                     Michigan
New Guys                 Texas
Acme                          Ohio
Gordon's                    Texas
Acme                          New York

In the example about we have one vendor in multiple states (Acme) and one state with multiple vendors (Texas). I need to be able to let the user chose to group by Vendor or State.

Thanks!

Author

Commented:
Had a typo! Although I fixed it by corrected my typo, your suggested solution forced me to re-examine everything so I'm accepting this solution. Thanks.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.