Forum Discussion

leilei787's avatar
leilei787
Helper II
4 years ago
Solved

An odd count question

Hi All: Happy Friday!   i have an odd question. here is my table below. i want to create a column that count how many times a customer show up   For example, customer A purchased 18 units on Jan...
  • tamerj1's avatar
    tamerj1
    4 years ago

    Hi leilei787 
    Actually now it is much easier. Check out the updated file https://www.dropbox.com/t/gnQXLqmohiDQaOqd
    You just need two measures

     

    First Purchase Date = CALCULATE ( MIN (Data[Order Date] ), Data[Amount] > 0 )
    Last Purchase Date = CALCULATE ( MAX (Data[Order Date] ), Data[Amount] > 0 )

     

     The CALCULATE is only required to restrict the calculation on real sales transactions otherwise a simple MAX/MIN would be enough and the filter context will take care of the rest. You just need to place the Customer at the rows of the matrix visual and the Products ( either two or more) on the columns. Then place the two measures at the values, and that's it.