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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
lancea
Helper I
Helper I

Dynamic Columns in Data Source

Suppose I have the following data source in Excel:

 

lancea_0-1625729450352.png

 

I have a problem retrieving data for the latest month in my visuals, because as the columns are re-arranged depending on which month it is. They are separated into actual sales and forecast. So for example, next month it will become:

 

lancea_1-1625729527328.png

Which breaks my visuals when I do a data refresh, since it no longer dispalys the latest month (which should now be Apr-21 Sales)

 

What are the workarounds for this?

3 REPLIES 3
V-lianl-msft
Community Support
Community Support

Hi @lancea ,

 

Based on your description,do you want to display the latest month's data after each refresh?

Is the data model exactly the same as the picture you provided? Does the date column exist in the data model?

 

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@lancea , I think you should first unpivot. Split and separate measure and month year (Split on last occurrence of space. an then pivot the measures again.

 

if need create date using month year

date = "01-" & [Month year] // change data type to date.

 

Then you find the latest month

max flag =

if([Date] = max([Date]), "Current Month", [Month Year])

 

You can filter of the current month

 

refer these if needed

https://radacad.com/pivot-and-unpivot-with-power-bi

https://www.tutorialgateway.org/how-to-split-columns-in-power-bi/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hello, thank you for the info. My question is how do I know which column to unpivot? Since the latest column is always changing. Or do I unpivot all columns starting from the Jan-21?

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.