Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Using slicer to get date and put into column

Hi, I want to use the slicer input to get the value (date) and substract the date with the other date in the other table. I already create a measure with this DAX, DateSelected = SELECTEDVALUE(Da...
  • hansei's avatar
    6 years ago

    Calculated columns are calculated once - on load. So SELECTEDVALUE will never be valid, and the column will not react to any changes you make in the report.

     

    Instead, create another measure akin to

    Days = SELECTEDVALUE(DateInput[DateInput]) - SELECTEDVALUE(INVENTBATCH[XFSRECEIVEDATE])

     and add the measure to the table or matrix where you want the value to appear. As long as rows are not summarized (so XFSRECEIVEDATE only has one value in a row), it should work. You may want to add ISBLANK tests or alternate values in the second argument to SELECTEDVALUE in order to handle cases where values are not scalar