Forum Discussion

NielsDW's avatar
NielsDW
Frequent Visitor
5 years ago
Solved

DAX help with dates

Hi, I'm struggling with a specific DAX code to create a visual with dates. The purpose of the visual is to represent succesful customers which obtained a good result in the last x months.  The le...
  • Anonymous's avatar
    Anonymous
    5 years ago

    NielsDW 

    I assume you want to create a slicer to change the date range dynamically, like last 1 month, 2 months, 3 months, etc.

     

    In this case, you may create a new table usiong enter data to create a slicer column with values, 1,2,3,4,etc. And use this column create a slicer on the report page. Then just replace the X to selectedvalue() in the dax.

     

    CALCULATE(DISTINCTCOUNT(Table[Customers], table[LastDateOfObtainedResult] >= DATE(YEAR(today(), MONTH(today()) - selectedvalue(newtable[slicer column]), DAY(today()).

     

    Paul Zheng _ Community Support Team
    If this post helps, please Accept it as the solution to help the other members find it more quickly.