Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Date Difference Calculation with what if parameters

Hello,

 

I am trying to calculate totals based on a what if parameter that filters by days selected within the "what if" parameter.

 

Therefore as per the below picture, I have selected March 11 2020 and would like to calculate totals from 12-13 march 2020 (+2 days in the what if parameter) 

 
using the below formula ive managed to change the date however im unsure about how to inbed the filtered count of incidents (the total shown is showing the total from 11-03-2020)

 

Days_comparison = 
 var incidents = [Count of incidents]

var comparison = Days[Date_difference]

var _date = min('Alex Date Period Flow'[Date])

var date_range = comparison + _date 

return date_range​

 

 

 

  • Anonymous , if you select a date and you need data more than data you need to have slicer on independent date

     

    //Date1 is independent Date table, Date is joined with Table
    new measure =
    var _max1 = maxx(allselected(Date1),Date1[Date])
    var _min = _max1

    var _max =_max1 + [What if meausre]
    return
    calculate( sum(Table[Value]), filter('Date', 'Date'[Date] >=_min && 'Date'[Date] <=_max))

2 Replies

  • Anonymous , if you select a date and you need data more than data you need to have slicer on independent date

     

    //Date1 is independent Date table, Date is joined with Table
    new measure =
    var _max1 = maxx(allselected(Date1),Date1[Date])
    var _min = _max1

    var _max =_max1 + [What if meausre]
    return
    calculate( sum(Table[Value]), filter('Date', 'Date'[Date] >=_min && 'Date'[Date] <=_max))