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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
rahul-opp
Helper I
Helper I

Dynamic column headers in matrix visual

Hello, 
I need to create a matrix view which show Units sold where first 4 columns are last 4 days, next 2 columns are current and previous week and next are  YTD and next 2 columns are  MTD of Current and Target
Expected output should be like
Screenshot 2025-02-10 at 5.56.15 PM.pngHere first 4 columns of dates should change dynamically daily. 
For example,
Today is 10-Feb-2025, then column should show previous 4 days which are 9-Feb, 8-Feb,7-Feb, 6-Feb.
So on next day , where Today = 11-Feb-2025, then column should show 10-Feb, 9-Feb,8-Feb, 7-Feb.

Same goes with Weeks, Current week is week#6, Previous week is week#5. When week changes ,Current week will be week#7, Previous week is week#6.

I have manged to create some portion of it. To get 4 days, I have created 4 measures, 
for example 
Units Sold_1DayAgo =
CALCULATE(
       [Total Units Sold],
       'Calendar'[Date] = TODAY() - 1
)

and dragged them into matrix visual Values well. This created the columns, but headers are not changing , they are static.  
Screenshot 2025-02-10 at 6.08.28 PM.pngHeaders of date columns should change dynamically as Today shifts. Also week header should change on week changes.
1. How to create dynamic headers for this?
2. I have created 4 measures for 4 days. Is there any better way to acheive same, how?
3. Is double header possible with matrix visual ( first image ) , how?

Thanks

2 ACCEPTED SOLUTIONS
miTutorials
Super User
Super User

If you have still not found a solution - I have made a video on this specific requirement - do check it out and let me know if this helps!

 

Stop Using Static Headers! Create a Fully Dynamic Power BI Matrix | MiTutorials

View solution in original post

rahul-opp
Helper I
Helper I

Apologies, guys. Sorry for the delayed reply. Occupied with other work.
I haven't implemented the suggestions. But checked the miTutorials solution, it will work for me. danextian's suggestions are aslo useful for my other requirements. 

View solution in original post

7 REPLIES 7
rahul-opp
Helper I
Helper I

Apologies, guys. Sorry for the delayed reply. Occupied with other work.
I haven't implemented the suggestions. But checked the miTutorials solution, it will work for me. danextian's suggestions are aslo useful for my other requirements. 

miTutorials
Super User
Super User

If you have still not found a solution - I have made a video on this specific requirement - do check it out and let me know if this helps!

 

Stop Using Static Headers! Create a Fully Dynamic Power BI Matrix | MiTutorials

Anonymous
Not applicable

Hi @rahul-opp ,

 

Whether the advices given by speedramps and danextian have solved your confusion, if the problem has been solved you can mark the reply for the standard answer to help the other members find it more quickly. If not, please point it out.

 

Best Regards,

Neeko Tang

Hello all, thanks for quick response. I will check the suggested solutions and reply back in some time.

Anonymous
Not applicable

Hi @rahul-opp ,

 

As we haven’t heard back from you, we wanted to kindly follow up to check if your issue is resolved? or let us know if you need any further assistance.
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

 

Best Regards,

Neeko Tang

speedramps
Super User
Super User

You could add a dummy row to your Platform table and call it "Date Range".
The letter D for Date  will be sorted before P for Plaform, so it wil appear under your header.

Then create a measure to return a single date or the date range as text

 

Date range text = 
SELECTEDVALUE('Calendar'[Date], 
MIN('Calendar'[Date]) 
& " to " &
MAX('Calendar'[Date]) 
)

 

 

Then use this in your all your measures

 

Units Sold_1DayAgo =
IF(SELECTEDVALUE(yourtable[Platform] = "Date range",
[Date range text],
CALCULATE(
       [Total Units Sold],
       'Calendar'[Date] = TODAY() - 1
)
)

 

 

Please click thumbs up just for the helpful suggestion

and click [accept solution] if it works.

danextian
Super User
Super User

Hi @rahul-opp 

 

You will need a disconnected table that contains a column containing the dates, week numbers, the words YTD, Current and Target and their categorization (MTD, Units), their custom column sort and then a measure referencing the values in the first column.  What you're trying to achieve is not impossible but definitely not for the beginners. Please see attached sample pbix files.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.