Forum Discussion

12Bowers12's avatar
12Bowers12
Icon for Helper V rankHelper V
5 years ago
Solved

Filter argument changing on the select date

Hello, everyone,

I have a query as below to summarize based on the LatestDate.

I am wondering changing the LatestDate based on the selection on the filter. If seleting 02/29/2020, the LatestDate changes to 02/29/2020 accordingly. If 03/31/2020, change to 03/31/2020. 

Should I also need to create another Date table?

Thank you for help.

Dennis

 

VAR LatestDate = DATE(2020,1,31)

   CALCULATE (

       Sum(Loss[Amount]),

       DateDim[DateKey] <= LatestDate   )

  • Thank both of you,

    Per Aiolos aproach, 'You can create a date slicer, the Power BI has the function that you want by default', it works well. 

    But is possible to create a measure or text box to remind the user the date selected?

    Or any other approach?

    Dennis

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi 12Bowers12 ,

     

    You can create a date slicer, the Power BI has the function that you want by default.

     

     

    Please try.

    Aiolos Zhao

  • vivran22's avatar
    vivran22
    Icon for Community Champion rankCommunity Champion

    Hello 12Bowers12 ,

     

    Is your objective to provide the input of LatestDate as a slicer selection instead of hardcoded date ?

     

    If yes, then you can use replace your VAR statement with:

    VAR LatestDate = MAX([Date Coulumn])

     

    If not, then please share more details around the requirement.

     

    Cheers!
    Vivek

    Blog: vivran.in/my-blog
    Connect on LinkedIn
    Follow on Twitter

    • 12Bowers12's avatar
      12Bowers12
      Icon for Helper V rankHelper V

      Thank both of you,

      Per Aiolos aproach, 'You can create a date slicer, the Power BI has the function that you want by default', it works well. 

      But is possible to create a measure or text box to remind the user the date selected?

      Or any other approach?

      Dennis

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi 12Bowers12 ,

         

        Yes. You can create a measure to show the date range, like:

         

        measure = “Date Range: " & min(your_date) & " - " & max(your_date)

         

        Please try.

        Aiolos Zhao