Forum Discussion

mosman's avatar
mosman
Frequent Visitor
6 years ago
Solved

Capture Time Slicer Minimum Value

Hello all,

 

I have a table with account number, balance, transaction date, and correspondance date. In my report I have a time slicer for the transaction date, so users can see balances for the account that have transation in a date range. This works fine, but I would like to create another measure, in which I would like to use the same range in the transaction date in the correspondence date.

Is there a way to capture the date range from the transaction column (Time Slicer) in a variable and use it in a different measure for the corresponance date?

  • Hi mosman ,

     

    You can create measure to get the date range like DAX below:

    Date range=
    Var MinDate = CALCULATE(MIN(Table1[transaction date]),ALLSELECTED(Table1[transaction date]))
    Var MaxDate = CALCULATE(MAX(Table1[transaction date]),ALLSELECTED(Table1[transaction date]))
    Return
    DATEDIFF(MinDate, MAXDate, DAY)

    Best Regards,

    Amy

     

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

4 Replies

  • v-xicai's avatar
    v-xicai
    Community Support

    Hi mosman ,

     

    You can create measure to get the date range like DAX below:

    Date range=
    Var MinDate = CALCULATE(MIN(Table1[transaction date]),ALLSELECTED(Table1[transaction date]))
    Var MaxDate = CALCULATE(MAX(Table1[transaction date]),ALLSELECTED(Table1[transaction date]))
    Return
    DATEDIFF(MinDate, MAXDate, DAY)

    Best Regards,

    Amy

     

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

  • Refer to this. You have to create an inactive join and activate it as per need. (Not exact but similar)

    https://community.powerbi.com/t5/Desktop/DATE-RANGE-SLICERS-TO-COMPARE-NETSALES-OF-A-DATE-RANGE/td-p/42251

     

    So you will relation with both dates with the same Date/time table.

    One join will be an inactive correspondence date.

    Activate correspondence date in a formula using use relation.

     

    Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
    Thanks.

    • amitchandak's avatar
      amitchandak
      Super User

      Min max can be taken 

       

      Change Date End = 
      Var _endDate= Maxx(ALLSELECTED('Date'[Date Filer]),ENDOFMONTH('Date'[Date Filer]))
      Var   _start_date= minx(ALLSELECTED('Date'[Date Filer]),'Date'[Date Filer]))
      
      
      return
      _endDate & " " & _start_date
  • v-xicai's avatar
    v-xicai
    Community Support

    Hi  mosman ,

     

    Does that make sense? If so, kindly mark the proper reply as a solution to help others having the similar issue and close the case. If not, let me know and I'll try to help you further.

     

    Best regards

    Amy