Forum Discussion

FBu_Gavin's avatar
FBu_Gavin
Regular Visitor
9 months ago
Solved

Dynamic Label in the Table for Measure based on Selected Date

Hi everyone,

I’ve simplified my question using the example below (see image).

 

I have a dataset showing Stock on Hand (SOH) by date and by product. In Power BI, I’d like to build a table (bottom section) where a dropdown slicer lets the user select the current date.

When a date is selected:

  • The table should show Current SOH for that date, and the column label should dynamically update to display the selected date.

  • The second column should show SOH for the previous day (selected date - 1), and its label should also update to reflect that date.

Essentially, I’m trying to create dynamic column headers that display the date values used in the calculation.

I previously used Qlik, which has a feature that allows users to define both a measure and its label expression. I’m looking for a similar capability in Power BI.

Any guidance or examples on how to achieve this in Power BI would be greatly appreciated.

Thanks,
Gavin

  • Hi FBu_Gavin 

     

    Power BI doesn't currently support dynamic column headers. You can either superimpose a card on the column headers or use a disconnected table containing a column that has all the possible combinations of  the date (formatted as text - dd/mm/yy, etc ) and your metric name and use a measure to determine which column values to return.

    Please see the attached sample pbix.

3 Replies

  • Hi FBu_Gavin 

     

    In PowerBI, column labels of matrices cannot dynamically return specified values.

     

    But you can create an auxiliary table to store the values of all possible column labels, and then use the feature of auto hiding the corresponding column when the matrix column is empty to achieve the goal.

     

     

     

    Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !

     

    Thank you~

  • Hi FBu_Gavin 

     

    Power BI doesn't currently support dynamic column headers. You can either superimpose a card on the column headers or use a disconnected table containing a column that has all the possible combinations of  the date (formatted as text - dd/mm/yy, etc ) and your metric name and use a measure to determine which column values to return.

    Please see the attached sample pbix.

    • FBu_Gavin's avatar
      FBu_Gavin
      Regular Visitor

      Thanks for the PBIX file! I’m currently using a card placed above the header, but your disconnected table approach gives me an alternative way to look at this issue.

      Cheers