Forum Discussion

BITomS's avatar
BITomS
Icon for Solution Supplier rankSolution Supplier
2 years ago
Solved

Date Data Type as 'What If' Parameter

Hi there all,

 

I was wondering if anyone had any experience with creating a Report Parameter (i.e. from the modelling tab within Report view, NOT a parameter within Power Query) with a date data type? And if so, how they went about doing this?

 

I've had a request from a business user where they'd like to be able to change a specific date to scenario model how this different start date can affect cost over a time period. The date would feed into a calculation based on market rates from this selected date.

 

Currently, parameters only seem to accept numeric values, so this may need to be an idea request, but thought i'd ask before creating this, especially if any of you bright souls had found a workaround.

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi BITomS ,

     

    Using the what if parameter is also essentially switching the contents of the field via slicer. I made simple samples as you described and you can check the results below:

    Total = SUM('Table'[Value]) 
    % = var _select = MIN('Table 2'[Date])
    var _period = CALCULATE(SUM('Table'[Value]),FILTER('Table',[Date]>=_select))
    RETURN DIVIDE(_period,[Total])

     

    An attachment for your reference. Hope it helps!

     

    Best regards,
    Community Support Team_ Scott Chang

     

    If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

     

2 Replies

  • BITomS , Usually we can achieve this using a disconnected Date table. Depending on what measure is needed

     

    You can switch date filter of date, or use the filter on multiple dates.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi BITomS ,

     

    Using the what if parameter is also essentially switching the contents of the field via slicer. I made simple samples as you described and you can check the results below:

    Total = SUM('Table'[Value]) 
    % = var _select = MIN('Table 2'[Date])
    var _period = CALCULATE(SUM('Table'[Value]),FILTER('Table',[Date]>=_select))
    RETURN DIVIDE(_period,[Total])

     

    An attachment for your reference. Hope it helps!

     

    Best regards,
    Community Support Team_ Scott Chang

     

    If this post helps then please consider Accept it as the solution to help the other members find it more quickly.