Forum Discussion
Dynamic column name based on a column value coming from a different unrelated table
Hi,
In TableB, create this custom culomn formula
The M code in Table A will be
let
Source = Excel.CurrentWorkbook(){[Name="TableA"]}[Content],
Custom1 = Table.RenameColumns(Source,List.Zip( { TableB[Column Name], TableB[Merged]}),MissingField.Ignore )
in
Custom1
Hope this helps.
This is working perfectly. However, every time we refresh the data (that changes the extract date for a particular column). It breaks the visual that these columns are listed such as on a table visual!
Any thoughts why is the case?
Any help is appreciated.
Thank you
Brij
- Ashish_Mathur2 years ago
Super User
You are welcome. I obviously will not be able to understand any reason from your sentence. Share a lot more details.
- Anonymous2 years agoNot applicable
Sorry if I was not clear enough in my ask.
From my original requirements, you provided a solution that is working fine and I can attach the dates that is coming from Table B to Table A's column names. Such as "Column1 - 22/05/2024" and we are presenting these columns in a Table visual on the report page like what I have shown in "Expected End result" in my original post.
However, as soon as we refresh the data tables (Table A and Table B), obviously the value in the "Extract Date" column from Table B will change and it also reflectingcorrectly on the TableA as well. e.g.
Before Refresh
Current Extract Date (Table B) value for Column1 = 22/05/2024 Hence the header for Column1 in Table A would change to "Column1 - 22/05/2024"
After Refresh
After refresh Extract Date (Table B) value for Column1 = 10/06/2024 Hence the header for Column1 in Table A would change to "Column1 - 10/06/2024"
However, I'm presenting these columns (From Table A) on the "Table" visual on the report page and as soon as I refresh the report, it should replace the column1 value from "Column1 - 22/05/2024" to "Column1 - 10/06/2024", instead it just showing me error for that visula with "Fix value" link and upon clicking on the link, this (and any other column that has a new associated dates) column disappears from the table visual!
The table visul would look like as per below after table refresh that changes extract date value for the column1 and column2. (These two column disappear from the table visual - I kept it in dark grey area just to show you how it should appear).
I hope this time it makes sense.
Please let me know if you can why is this happening?
Thank you,
- Ashish_Mathur2 years ago
Super User
I do not know why this is happening.