Search code examples
powerbipowerquerypowerbi-desktop

How to set up dynamic date cards


I'm working on a project and there's this last small thing I need to figure out.

I have a waterfall graph, and I'm overlaying some cards on the x axis to display start and end date rather than the default values (the dates in the waterfall below are cards).

(https://i.sstatic.net/KRtTk.png) (https://i.sstatic.net/yXMPw.png)

I have a date slicer, and what I'm trying to do is tie the left card to the start date. I want it to show the first of the month if the first of the month is selected but show the first of the next month if anything else is selected. The problem I'm having is that in order for this waterfall to work, my calendar table needs to be set up quarterly, see below.

(https://i.sstatic.net/zdKK8.png)

Therefore, the card is automatically going to the end of each quarter, no matter what I do. What's the best way to accomplish this?

I've tried using functions to change the display month, but the problem is, there is no consistent st5andard I can set looking at the end of quarter. I need the card to tie to the date on the slicer rather than the end of quarter date.


Solution

  • Try this as a new measure for the left tile

    Start Date Tile = 
      var startD = MIN('TheSlicerDateTable'[TheSlicerDateColumn])
      return IF(
        DAY(startD) = 1,
        startD,
        DATE( YEAR(startD), MONTH(startD) + 1, 1 )
      )
    

    The above will work so long as the dates used by slicer are continuous.