Forum Discussion

Suhel_Ansari's avatar
Suhel_Ansari
Helper V
3 years ago

Create a Column Based on the Selected Date Range

Hi All,

I want to create a New columns based on the selected Date range slicers from the based on teh date picker, I have creaetd "Selected Min Date" and "Selected Max Date" as seen in the screen print, so based on the date selected I want a New Columns for Min Date and Max Date, please assist.

Date Table:- Date = CALENDAR( DATE( 2015 , 1, 1) , DATE( YEAR( TODAY()) + 1 , 12 , 31))

Selected Max Date: - Selected Max Date = CALCULATE( Max('Date'[Date]) , ALLSELECTED('Date'[Date]))

Selected Min Date :- Selected Min Date = CALCULATE( MIN('Date'[Date]) , ALLSELECTED('Date'[Date]))

Now i want to create 2 New columns Min Date which should be the Selected Min Date & Max Date Columns which should be Selected Max Date, please assist I am facing the following error. Thanks

Regards

Suhel

4 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Suhel_Ansari Can't do that. Calculated columns are not dynamic. They are calculated at refresh time. You will need to create a measure.

    • Suhel_Ansari's avatar
      Suhel_Ansari
      Helper V

      Greg_Deckler  , I have cretaed the Measure All I need is the output of Selected Min date as input to new column, I need Year of seleced Min Date in new column .. 

      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

        Suhel_Ansari You simply can't do that. A calculated column in DAX is only calculated at the time of refresh. It is not dynamic based upon selections by users. It doesn't matter what you try, that is never going to change.