Forum Discussion

niel_orvyn1's avatar
niel_orvyn1
Icon for Helper III rankHelper III
6 years ago
Solved

Calculating (Sum) when using a between date slicer: Calculate between values only

Hi there,

I want to display the total value for a month by using the between slicer.
However, when I try and make it easier for the user so the user can select from the first of the montht the 1st of the second month I gives me the total for both months.

 

Any ideas to change measure or do I have to change my approach? 

I will use the same page to insert SAMEPERIODASLATYEAR and add an KPI card. 

 

Many thanks.

 

Rgds,

Niel

  • niel_orvyn1 , Try to have separate date table Try

    measure =
    var _max = eomonth(maxx(allselected(Date),Table[Date]),0)
    var _min = eomonth(minx(allselected(Date),Table[Date]),-1)+1

    return
    calculate(sum(Tbale[value]),filter(all(Table[Date]), Table[Date] >=_min && Table[Date] <=_max))


    measure =
    var _max = eomonth(maxx(allselected(Date),Table[Date]),0)
    var _min = eomonth(minx(allselected(Date),Table[Date]),-1)+1

    return
    calculate(sum(Tbale[value]),filter(all(Date[Date]), Date[Date] >=_min && Table[Date] <=_max))

     

     

    So time this can group data into few dates. if that happens refer to this video

    https://www.youtube.com/watch?v=duMSovyosXE

3 Replies

    • niel_orvyn1's avatar
      niel_orvyn1
      Icon for Helper III rankHelper III

      AllisonKennedy  and  amitchandak 

       

      Many thanks for both your replies and help. Adding a dimdate table solved my problem, previously I was using the date from the original table😞

       

      Best Regards,

       

      Niel

  • niel_orvyn1 , Try to have separate date table Try

    measure =
    var _max = eomonth(maxx(allselected(Date),Table[Date]),0)
    var _min = eomonth(minx(allselected(Date),Table[Date]),-1)+1

    return
    calculate(sum(Tbale[value]),filter(all(Table[Date]), Table[Date] >=_min && Table[Date] <=_max))


    measure =
    var _max = eomonth(maxx(allselected(Date),Table[Date]),0)
    var _min = eomonth(minx(allselected(Date),Table[Date]),-1)+1

    return
    calculate(sum(Tbale[value]),filter(all(Date[Date]), Date[Date] >=_min && Table[Date] <=_max))

     

     

    So time this can group data into few dates. if that happens refer to this video

    https://www.youtube.com/watch?v=duMSovyosXE