Forum Discussion

T_von_Axt's avatar
T_von_Axt
Helper I
4 years ago
Solved

How do I use Date Slicers in Formulas?

Hello,   I am currently having issues with a specific use-case where I need to get both date values from a date slicer and then use it in a formula:   This slicer uses data from a single co...
  • amitchandak's avatar
    4 years ago

    T_von_Axt , Try a measure like

     


    measure =
    var _max = maxx(allselected('Table'),'Table'[Date]) // Use Date(2021,01,31)
    var _min = eomonth(_max,-12) +1
    var _calc = calculate(count(Table[Document No]), filter(all('Table'), 'Table'[Date] >=_min && 'Table'[Date] <=_max))
    return
    if(isblank(_calc) && max('Table'[Date]) <_max , 0, _calc)

     

    But better have date table. Independent date table will do better

     


    measure =
    var _max = maxx(allselected('Date'),'Date'[Date]) // Use Date(2021,01,31)
    var _min = eomonth(_max,-12) +1
    var _calc = calculate(count(Table[Document No]), filter(('Table'), 'Table'[Date] >=_min && 'Table'[Date] <=_max))
    return
    if(isblank(_calc) && max('Table'[Date]) <_max , 0, _calc)