Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Syndicate_Admin
Administrator
Administrator

Dynamic columns in table or matrix visualization

I need to ask you for help, with a requirement that may look easy, but it has me spinning.

I have a report that they give me of accounting, which shows the correlation of the last months processed for companies, for each branch and with its code.

The detail is that I was asked to load this "summary" as it is in a powerbi report, plus the total per column, of those with values. The detail of all this is that the columns of months are changing their name, according to the month in which it is processed:

1.jpg

In the example of the photo, it is processed from Oct 22 backwards (it is not in order), then, for the next process of the following month, these columns change name and only keeping as constant name the columns "Dif, Average, Dif Average, Withheld, Preinvoiced, Manual and Contract"... Then, for the next period the columns could be renamed to "Jan 23, Dec 22, Nov 22.... etc"

Then... How could I get the names of the columns and be able to create a visualization of tables, which loads me the same information, but dynamically absorbing the names of the columns and showing them in the visualization, showing the total at the end, for the fields that are numeric.

I hope you understand what I need and first, thanks

3 REPLIES 3
v-shex-msft
Community Support
Community Support

Hi @vfh_2023,

Did you mean to dynamic rename these date fields based on current system date? If that is the case, you can try to enter to query editor to add rename column step based on M query functions.

BeforeBefore

AfterAfter

#"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Column2", Date.ToText(Date.From(DateTime.LocalNow()),"MMM-yy")}, {"Column3", Date.ToText(Date.AddMonths(Date.From(DateTime.LocalNow()),1),"MMM-yy")}, {"Column4", Date.ToText(Date.AddMonths(Date.From(DateTime.LocalNow()),2),"MMM-yy")}})

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Thank you very much for this information, but my problem does not come from wanting to change the name of the column dynamically, but when adding the columns in a visualization, since when changing the name every month, this will give me an error at the time that the name of that column is another.

Hi @vfh_2023

>>but when adding the columns in a visualization, since when changing the name every month, this will give me an error at the time that the name of that column is another.

I think this is an expected issue if the source table field names will change dynamically.

AFAIK, the query tables will cache the table structure(fields name, type) into the steps, and they did not synced fields names when the source fields name changes. 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors