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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Naverie
Helper I
Helper I

Dynamic column headings - based on todays date

Hi,

 

I'm really hoping this is possible. 

In an SSRS report we were able to code the column headings so they are dynamic based on todays date. I'm wanting to do the same in a table (it can be a matrix if needed).

 

I've currently just renamed the columns but obviously this isn't going to work when the report is published.

Naverie_0-1629979904382.png

 

This is how we did it in SSRS:

 

= "D " +
vbcrlf + format(today(),"ddd") +
vbcrlf + format(today(),"dd/MM")

 

and then:

= "D+1 " +
vbcrlf + format(dateadd("d",1,today()),"ddd") +
vbcrlf + format(dateadd("d",1,today()),"dd/MM")

etc

 

Thanks in advance

8 REPLIES 8
Greg_Deckler
Community Champion
Community Champion

@Naverie Only way I can think of is to have your table headers in a disconnected (maybe connected) table so that it recalculates at refresh. Then use these columns. So, for example:

Table = 
  DATATABLE(
    "Heading",STRING,
    {
      {"D" & FORMAT(TODAY(),"dd/MM")},
      {"D+1" & FORMAT(TODAY()+1,"dd/MM")},
      {"D+2" & FORMAT(TODAY()+2,"dd/MM")}
    }
  )


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler thank you for your response.

 

I've just tried that and am getting this error:

 

The tuple at index '1' from the table definition of the DATATABLE function does not have a constant expression in the column at index '1'.

 

I have pasted it into a measure exactly as it is. Is that correct?

 

Thanks

@Naverie Oh yeah, DATATABLE... Try a straight table constructor:

Table 4 = 
    {
        "D" & " " & FORMAT(TODAY(),"dd/MM"),
        "D+1" & " " & FORMAT(TODAY()+1,"dd/MM"),
        "D+2" & " " & FORMAT(TODAY()+2,"dd/MM")
    }


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler 

I am having a right mare with this 😂

 

Am now getting this and the table not loading?

 

A table with multiple values was supplied where a single value was expected

@Naverie The formula is for a table. So you need to go to Modeling tab, click New Table and then enter the formula. This will not work for a column or measure.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler so I was having a proper thick moment then lol!

 

That's now pulled through the values but in one column.

 

I'm assuming the way round this is to have a table for each of the ones I want?

 

@Naverie Oh, hmm, I was thinking a matrix visual for some reason. So, am I to understand that you are using this in a table visualization? 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

This is the whole table. Ideally it needs to stay as a table as this is how they now view the data.

 

Naverie_0-1629986580679.png

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.