Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowJuly 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more
I am wondering if it is possible to create a formula (m-code most likely I guess) that can search column headers that contain the current year value, then use that columns data to evaluate/compare with other data I have in other columns for the current year.
I have column headers that have 2023, 2024 and soon to have 2025...and want to only evaluate data for 2023...but I want to set the report up dynamically enough to adjust based on the current year. This way, when we roll into a new year, the bi report adjusts and uses data from the 2024 column(s).
I'm sure with the word Power in Power BI means it can do this! I just need some guidance on making it happen! I know you geniuses out there can help guide me through this please!
Thanks in advance.
Hi,
The problem could be much simpler to solve if we use the "Unpviot Other Columns" feature in the Query Editor. To receive further help, share some data, explain the question and show the expected result.
Ashish,
The question is: is it possible to create a formula (m-code most likely I guess) that can search column headers that contain the current year value?
And if I could show the expected result, then I wouldn't need to make the post...because I would've figured it out! lol.
Say I have some headers that look like this in the screen shot.
And I want a formula that can look at the header names and find those headers that contain the current year in them.
Hi,
I am convinced that "Unpivoting other columns" is the way to go.
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.
| User | Count |
|---|---|
| 63 | |
| 41 | |
| 39 | |
| 39 | |
| 39 |