Replicating a Dimension Hierarchy in Excel
For those of us still using earlier versions of TM1 where Active Forms are not available, below is a set of VBA code that would enable you to recreate the dimension tree in your excel reports .
In this example, we have a list of sales area managers from the Sales Managers dimension derived using the ELCOMPN formula. The objective is to make the list resemble the dimension hierarchy in TM1 as shown below.
Below is the list of Sales Managers.The numbers along side the elements are the indentation value and also serves as the grouping levels.
VBA Code for the Indentation
For row = firstrow to lastrow indentval = CDec(Cells(row, col2).Value) If indentval> 0 Then Cells(row, col).Select Selection.InsertIndentindentval End If Next row
Note : col refers to the column with the names of sales managers and col2 refers to the column that has the indentation value
Code for Grouping
For z = firstrow To lastrow grplvl = Cells(z,col2).Value If grplvl = 3 Then s = z + 1 Do While Cells(s, col2).Value = 4 s = s + 1 Loop Rows(z + 1 & ":" & s - 1).Select Selection.Rows.Group z = s - 1 End If Next z