0

Using the faking multi-column report using tables method here:[https://stackoverflow.com/questions/10882784/ssrs-how-to-continue-data-to-next-column]

I need a report to show multiple columns sorting my data across and then down the page. I need page breaks by Category and the title of each category to repeat on the page. I have 4 identical tablixes across my page with =IIF((RowNumber(Nothing) Mod 4) = 1, False, True) ect. in the row visibility and a sort on $. The 4 tablixes are wrapped in a list that is grouped by Category with a page break between each group.

Here are my issues if you can help: If I just have my 4 tablixes across the page with the sort it works fine and sorts properly.

  1. When I try to add the page break and grouping, I get the sort wrong. The page will break by category but if the data in a grouping doesn't end in the 4th column the next page seems to start where the previous page ended. For example, page 1 ends in column 3 so page 2 starts with column 4 instead of 1. How can I adjust this so the next page always starts in the 1st position with the highest $ by category.

  2. If the category goes more that 1 page - I lose the headings.

1 Answer 1

0

Update: the OP has explained that their problem is that they aren't using SQL at all, this is a DAX problem. So I will update my (already lengthy) instructions for how to do this, with a followup article that deals with the same problem but using DAX instead of SQL to get the required columns to do this work properly.

For anybody who is just casually interested, the short answer resolution is that this is hard to do with a lot of tweaking of specialized design objects in the RDL, and it's not very extensible that way, because you're going to have to hardcode your individual column-tablixes in the designer. BUT it quite easy to do with a dataset that contains proper column and row index values; you only need ONE tablix and you can dynamically set up the number of columns without a bunch of work. Then you group by the row index and the column index, you're done.

So, in the OP's case, the problem is getting those two index values into the dataset. I found this pretty straightforward -- in fact, doing it allowed me to go back and somewhat simplify the required SQL as well -- EXCEPT :

If the report requires a row grouping to be included in the designer object it's more difficult to get the column and row index values to be appropriate to the group level values that you will need. In SQL, this is just a simple case of adding a PARTITION BY instruction, but there are numerous articles on the web about how to do the same thing in DAX, none of which seemed to work for me -- I'm not a DAX expert, so maybe somebody else will chime in with the right way to do that?

So, for DAX, I start with the same basic technique, I will still use one tablix, but I will add some expressions into the row and column groupings to compensate. Still pretty easy and still completely dynamic, and maybe we could do without the exception if a DAX expert wants to think over the problem. What you're looking for is a row and column assignment that looks like this (assuming 2 cols have been requested, group is needed, items are alphabetically sorted, and you need to go Down-Then-Across):

Group Item Row Index Col Index:
Fruit Apple 1 1
Fruit Peach 2 1
Fruit Pear 3 1
Fruit Persimmon 1 2
Fruit Rasberry 2 2
Veg Carrot 4 1
Veg Cauliflower 5 1
Veg Green Bean 4 2

resulting in :

Group Col 1 Col 2
Fruit Apple Persimmon
Peach Rasberry
Pear
Veg Carrot Green Bean
Cauliflower

Or like this, matching the OP's requirement, Across-Then-Down, again assuming 2 cols and alpha sort:

Group Item Row Index Col Index
Fruit Apple 1 1
Fruit Peach 1 2
Fruit Pear 2 1
Fruit Persimmon 2 2
Fruit Rasberry 3 1
Veg Carrot 4 1
Veg Cauliflower 4 2
Veg Green Bean 5 1

resulting in:

Group Col 1 Col 2
Fruit Apple Peach
Pear Persimmon
Rasberry
Veg Carrot Cauliflower
Green Bean

Without grouping DAX in either direction will work exactly the same way as the SQL version, and can be swapped as datasets into the same tablix with no other changes, in fact.

The OP also mentioned needing to repeat the headings, which was already anticipated in the original article and continues to work fine.

While this response is lengthy -- in hopes of getting a DAX expert to provide a way that will allow RANKX to give the right grouped index values directly in the dataset -- I'm not being coy by not working out the code details here; that will be longer, deserves to be a blog article.

So here it is: Snaking Columns for I hope the last time ever

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.