Forum Discussion

johankent30's avatar
johankent30
Icon for Helper I rankHelper I
7 years ago
Solved

DAX Variable Date Column

I am trying to create a column in power bi that will change based on a slicer selection. For example, let's say that I have the table below: Date | Column A | Column B 1/1/2019 ...
  • Anonymous's avatar
    Anonymous
    7 years ago

    johankent30  - 

    One possibility:

    1. Store the Date +A as one Calculated Column, Date +B as s second Calculated column

    2.  Create a disconnected Parameters table, with column Add Type.

    3.  Create a measure like this: (You could do the date math in the measure, but I find it cleaner to do it this way and it may improve performance.)

     

    Date Picker = 
    IF(
    	SELECTEDVALUE('Parameters'[Add Type]) = "A",
    	MAX(<yourtable>[DateA]),
    	MAX(<yourtable>[DateB])
    )