Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Date picker

Hi,

 

My input dataset is as follows:

 

The date picker will show all the dates. Based ont he dates I choose fromt he date picker, the table will have last 4 months from the selected date displayed int he table as shown below.

I would like my output to be as follows:

 

 

Any ideas??

8 Replies

  • Anonymous I would recommend using relative date filter function, like show last 4 months etc.

     

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

    Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi parry2k ,

       

      I've now edited my post.. Sorry 

      • parry2k's avatar
        parry2k
        Super User

        Anonymous my reply is the same, use relative date filter, much easier to work with otherwise you have to create disconnected table for slicer and then work with measures, etc, can be achieved but seems overkill when relative date filter can achieve the same goal.

         

        I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

        Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

  • Anonymous's avatar
    Anonymous
    Not applicable

     Hi Anonymous ,

    According to my understanding, you want to  dynamically display the data for the last four months based on the slicer, right?

     

    You could use the following formula:

    //create a table for slicer

    forSlicer =
    ALLSELECTED ( 'Dynamic'[Date] )
    last4 =
    VAR selected =
        MAX ( forSlicer[Date] )
    VAR minDate = selected - 4 * 30
    RETURN
        IF (
            SELECTEDVALUE ( 'Dynamic'[Date] ) <= selected
                && SELECTEDVALUE ( 'Dynamic'[Date] ) >= minDate,
            1,
            0
        )

    My visualization looks like this:

     

    Is the result what you want? If not, please upload some data samples and expected output.

    Please do mask sensitive data before uploading.

     

    Best Regards,

    Eyelyn Qin

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    Did I answer your question ? Please mark my reply as solution. Thank you very much~

    If not, please upload some insensitive data samples and expected output.

     

    Best Regards,

    Eyelyn Qin