Forum Discussion
StuBee
5 years agoHelper I
Headers Changing Position
Hi Everyone, I recieve files each week with a double header Row First row as country (but a merged cell) Second row is a list of units etc sp UK Total Count ...
- 5 years ago
Hi StuBee ,
For this to be dinamic one of the options is:
- Create a new table with the same source of the previous one and keep only the two top rows:
Table 1
Table 2
- On the second table
- Add an index
- Select all columns and unpivot
- On the Column Value replace all blanks by null
- Insert a custom column that retrieves the Column number from the Attribute column
- Sort rows by (attention of order):
- Text after delimiter (column created in the previous step)
- Index
- Add a custom column with the following code:
if [Index] = 0 then [Value] else null- On the column you just created do fill down:
- Add a new custom column with the following code:
if [Value] = [Custom] then null else [Custom] &" - " & [Value]- Remove all columns except attribute and the FinalHeader
- Filter all null values from the final header
- Select all columns
- Pivot and select dont'aggregate
- Go to the first table
- Append
- Now append the second table on the first one
- Be aware that you need to redo your step on the formula bar and change the order of the tables:
- Promote first row has headers and remove top 2 rows
- Disable load on table2
- This will now be dinamic if you add more columns.
Check PBIX file attach.
MFelix
5 years agoSuper User
Hi StuBee ,
For this to be dinamic one of the options is:
- Create a new table with the same source of the previous one and keep only the two top rows:
Table 1
Table 2
- On the second table
- Add an index
- Select all columns and unpivot
- On the Column Value replace all blanks by null
- Insert a custom column that retrieves the Column number from the Attribute column
- Sort rows by (attention of order):
- Text after delimiter (column created in the previous step)
- Index
- Add a custom column with the following code:
if [Index] = 0 then [Value] else null
- On the column you just created do fill down:
- Add a new custom column with the following code:
if [Value] = [Custom] then null else [Custom] &" - " & [Value]
- Remove all columns except attribute and the FinalHeader
- Filter all null values from the final header
- Select all columns
- Pivot and select dont'aggregate
- Go to the first table
- Append
- Now append the second table on the first one
- Be aware that you need to redo your step on the formula bar and change the order of the tables:
- Promote first row has headers and remove top 2 rows
- Disable load on table2
- This will now be dinamic if you add more columns.
Check PBIX file attach.