Forum Discussion

Matty's avatar
Matty
Helper II
8 years ago
Solved

Highlight current week in column chart...

Hi Team,

 

I have a time series column chart in Power BI with dates along the x axis.  To help readability, a user has requested a means of highlighting the current day's date.

 

If I was to do this in Excel, I would add a vertical line using error bars to highlight the current date, but I don't think Power BI has this functionality currently.

 

Anyone manage to achieve someing akin to this in Power BI?  If so, how did you achieve it?

 

Cheers,

 

Matty  

3 Replies

  • v-danhe-msft's avatar
    v-danhe-msft
    Microsoft Employee

    Hi Matty,

    Based on my research,there is no OOTB feature to add this kind of line in Power BI charts currently. To work around the issue, you can create a measure to only show additional column bars for current week.  

    1.I have entered some sample data like the picture below:

    2.

    2.Create a measure.

    Measure = IF(WEEKNUM(TODAY())=WEEKNUM(CALCULATE(MAX('Table1'[Date]))),CALCULATE(SUM(Table1[Value])),BLANK())

    3.Create a Column chart and add the related fields, you can get the result like the picture below:

    For your requirement, you could also vote for this idea: https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/19550122-vertical-reference-lines-on-the-x-axis

     

    You can also download the PBIX file to have a view.

    https://www.dropbox.com/s/53j7x7t7qojhrj0/Highlight%20current%20week%20in%20column%20chart.pbix?dl=0

     

    Regards,

    Daniel He

    • Matty's avatar
      Matty
      Helper II

      Thanks for responding, Daniel.

       

      Your idea works, but it isn't quite what I'm after.  I have voted for idea via the link you sent.

       

      Thanks again.

       

      Matty 

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Matty,  I created two sets of values which I used to evaluate if the data is in the current week or not.

         

        Current Week = if(Weekly[num]=Weekly[Current_WeeK],1,0)

        Current Week  = if(Weekly[Current Week]=1,Weekly[Data_value],0)

        Running= if(Weekly[Current Week]=0,Weekly[Data_Value],0)