Forum Discussion

johnbasha33's avatar
johnbasha33
Super User
2 years ago
Solved

Dynamic Slicers with 2 dates

Hi there esteemed community members.   i have a scenario as below below is a sample data, i have share prices for Apple for different dates. i duplicated date column as start date and end date. ...
  • hackcrr's avatar
    hackcrr
    2 years ago

    Hi, johnbasha33 

    You need to drop one of the columns of end date or start date and store it in a table of calculations and put it into the slicer as shown in the following figure:

    End day table = SUMMARIZE('Table','Table'[End Date])

    I created the following two metrics:

    share price of end date = 
    VAR _end_day = SELECTEDVALUE('End day table'[End Date])
    RETURN CALCULATE(SUM('Table'[Share Price]),FILTER(ALL('Table'),'Table'[End Date]=_end_day))
    share price of start date = 
    VAR _start_day = SELECTEDVALUE('Table'[Start Date])
    RETURN CALCULATE(SUM('Table'[Share Price]),FILTER(
        ALL('Table'),
        'Table'[Start Date]=_start_day
    )
    )

    I use both metrics in the table visual:

    The results are as follows:

     

    Best Regards,

    hackcrr

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

     

     

     

  • GauravAher73's avatar
    2 years ago

    Hi,

     

    You can unpivot Start date and end date columns, so you will get values column in which all dates will be stored ,
    now you can use values column in between slicer and get share price from date range