SSRS level function to format recursive Tablix group

II will extend report created in post and show you how you can implement formatting for recursive group with the Level function.

Open report from the mentioned post or use another one with recursive Tablix group. Choose any of an item in the Tablix. I chose the Path text box since it will be more illustrative. Click on the Textbox and go to Properties Pane to Padding section, Left, Expression and put following formula.

Level function
Picture 1 – Level function

You should see similar settings in Properties Pane as on the picture bellow.

Level function Properties Pane
Picture 2 – Level function Properties Pane

Look at the report on picture bellow. You can see that the Path Textbox has dynamic padding based on how many recursive child’s current item has. As states in short description, Level function Returns a zero-based integer representing the current depth level of a recursive hierarchy. It helps in our scenario to change format of Padding property based on which depth level of hierarchy is current item placed.

Recursive Tablix group with dynamic padding format
Picture 3 – Recursive Tablix group with dynamic padding format