Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

max value selected in date slicer

I have a date slicer, I need to get the max of the date select to pass it as a parameter of a dax function :

 

I tried :

 

selected_date= CALCULATE(max('Calendar'[date]);(ALLSELECTED('Calendar'))

 

Table= Filter (CURRENCY_RATE; CURRENCY_RATE[Date]=selected_date)


in this example:

 

 


I would like to filter the table on the last value selected (=13/06/2017)

 

 

and get only this row:

 

 

could you please help me how can I do it?

 

Thanks in advance

  • Hi Anonymous,

    If you want to create a new table and make it be dynamic with the slicer, I am afraid you could not achieve this feature currently, you could try to use the Top N filter in the visual filter to get your desired result:

    You could also download the pbix file to have a view.

     

    Regards,

    Daniel He

9 Replies

  • v-danhe-msft's avatar
    v-danhe-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi Anonymous,

    If you want to create a new table and make it be dynamic with the slicer, I am afraid you could not achieve this feature currently, you could try to use the Top N filter in the visual filter to get your desired result:

    You could also download the pbix file to have a view.

     

    Regards,

    Daniel He

  • Hi,

     

    Assuming you have a Calendar Table and a relationship from the Date column of the Currency_Rate Table to the Date column of the Calendar Table, try this measure to get the rate on the last date of the date selected in the slicer range.  Ensure that the slicer is built from the Calendar Table

     

    =CALCULATE(MAX(Currency_Rate[Currency_rate]),DATESBETWEEN(Calendar[Date],MAX(Calendar[Date]),MAX(Calendar[Date])))

     

    Does this help?

    • Anonymous's avatar
      Anonymous
      Not applicable

      The return value of the function is "currency code".

      But I want to select all rows corresponding to the max value selected in "slicer date".

       

      This DAX formula works but isn't dynamic in relation to the selected value (slicer date).

       

      Table 2 = filter(CURRENCY_RATE; CURRENCY RATE[VALID_FROM]=DATEVALUE("30/04/2017"))

       

      This should be dymanic : DATEVALUE("30/04/2017") 

       

       

       

       

      • Ashish_Mathur's avatar
        Ashish_Mathur
        Icon for Super User rankSuper User

        Hi,

         

        Does this work?

         

        Table 2 = filter(CURRENCY_RATE; CURRENCY RATE[VALID_FROM]=MAX(Calendar[Date]))

    • chuallanca's avatar
      chuallanca
      Regular Visitor

      What if you don't have the relationship between the calendar and that particular table ? How would you propose to get the max and min of the selectedvalue form the slicer?