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
jlankford
Advocate I
Advocate I

How to handle columns that change each refresh?

Walmart gives data on a week by week basis. They name columns YEARWEEK, so last week was 201736.

 

Data gets refreshed each week, and we call the previous 52 weeks. 

 

This poses two issues each refresh:

 

1.) The oldest week is no longer there, and there's now a new oldest week. "201636" will not be a column in the next refresh

2.) The newest week (201737) will show up.

 

So what are my options outside of manually adding them to the tables, and manually rewriting all my measures that use these columns?

 

Thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I'm assuming you're going to combine these columns into a single set with the column names as descriptors.

 

If you use the Table.UnpivotOtherColumns function, it should just work regardless of column names. You'd have something like this:

#"Unpivoted Columns" = Table.UnpivotOtherColumns(Source, {}, "Attribute", "Value")

Whereas "Attribute" would be the new column title for your previous column names (dates) and the value would be whatever is underneath that. If you have more than one row per column, I'd have to see a sample of your data to investigate further.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

I'm assuming you're going to combine these columns into a single set with the column names as descriptors.

 

If you use the Table.UnpivotOtherColumns function, it should just work regardless of column names. You'd have something like this:

#"Unpivoted Columns" = Table.UnpivotOtherColumns(Source, {}, "Attribute", "Value")

Whereas "Attribute" would be the new column title for your previous column names (dates) and the value would be whatever is underneath that. If you have more than one row per column, I'd have to see a sample of your data to investigate further.

Thank you - I wasn't able to try this as ultimately, I found a better way to query my data from the source that adds a "date" column with all date values rather than a date column for each separate day or week (365 additional columns). 

 

I do appreciate your help, and I'm glad I can reference this later. Unpivoting hadn't occurred to me. Makes a lot of sense. 

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.