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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Courtsheagraham
Regular Visitor

Dynamic Column Header Search

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.

3 REPLIES 3
Ashish_Mathur
Super User
Super User

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. 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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.

JarrellCo_1-1688312396877.png

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.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.