Forum Discussion

kolbra07's avatar
kolbra07
Frequent Visitor
6 years ago

Changing Customer Payment Behaviours Over Time

We're looking at tracking a change in customer trends over a selected time period , so say they paid using one payment method in January but switched to a different payment method in March . Is there a way that this can be identified in a DAX expression ?

4 Replies

  • az38's avatar
    az38
    Community Champion

    kolbra07 hi

    of course, there is a way, but to choose the most appropriated one, please share your data sample and desired output

    • kolbra07's avatar
      kolbra07
      Frequent Visitor

      Yes of course so we have data like this :

       

      Customer              Payment Date                  Payment Method

       

      A                                 8/1/20                                   Cheque

      A                                 3/3/20                                   Bank Transfer

       

      So we would like to show that customer A has changed their payment method from Cheque to Bank Transfer .

      • az38's avatar
        az38
        Community Champion

        Hi kolbra07 

        I still not sure how exactly it should look like but try a measure

        Measure = 
        var _curDate = MAX('Table'[Payment Date])
        var _prevDate = CALCULATE(MAX('Table'[Payment Date]), 'Table'[Payment Date] < _curDate, ALLEXCEPT('Table', 'Table'[Customer]))
        var _prevPaymentMethod = CALCULATE(FIRSTNONBLANK('Table'[Payment Method], 1), 'Table'[Payment Date] = _prevDate, ALLEXCEPT('Table', 'Table'[Customer]))
        RETURN
        IF(_prevPaymentMethod <> MAX('Table'[Payment Method]) && NOT(ISBLANK(_prevPaymentMethod)), TRUE(), FALSE())