Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Firstnonblank measure help

Hello All,

 

I have a table with clients, date and deposit amount. What I want is to count how many clients made  first deposit and how much they deposited with the most efficient way. 

 

What I did:  

I created a new table with clients and the min date for each one. Then I run a lookup and I put "YES" if the FTD date match with the Deposit Date . Then I count and sum with filter "YES". 

 

FTD count = 5

FTD amount = 950

 

I suppose that there is a more efficient way to calculate the above with firstnonblank, without using additional table. Can anyone help me out? 

 

See below:

Table at the beginning.

ClientDeposit DateDeposit Amount
a01/01/2019100
b02/01/2019200
c03/01/201950
d04/01/2019400
e05/01/2019200
d06/01/201950
a07/01/201980
b08/01/2019800
c09/01/201990
d10/01/2019150
a11/01/2019250
a12/01/2019300
b13/01/2019180
c14/01/201990
d15/01/201970
a16/01/201950

 

Table Created:

ClientFTD Date
a01/01/2019
b02/01/2019
c03/01/2019
d04/01/2019
e05/01/2019

 

Final table:

Original Data TableCalculated Columns
ClientDeposit DateDeposit AmountFTD DateFTD (YES/NO)
a01/01/201910001/01/2019YES
b02/01/201920002/01/2019YES
c03/01/20195003/01/2019YES
d04/01/201940004/01/2019YES
e05/01/201920005/01/2019YES
d06/01/20195004/01/2019NO
a07/01/20198001/01/2019NO
b08/01/201980002/01/2019NO
c09/01/20199003/01/2019NO
d10/01/201915004/01/2019NO
a11/01/201925001/01/2019NO
a12/01/201930001/01/2019NO
b13/01/201918002/01/2019NO
c14/01/20199003/01/2019NO
d15/01/20197004/01/2019NO
a16/01/20195001/01/2019NO
  • Hi Anonymous 

    You can add this two columns to yourTable.

     

    FTD = CALCULATE(
        MIN(yourTable[Deposit Date]),
        ALLEXCEPT(yourTable, yourTable[Client])
    )
    FTD (YES/NO) = 
    IF(yourTable[Deposit Date] = yourTable[FTD], "YES", "NO")

    Regards,
    Mariusz

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

2 Replies

  • Mariusz's avatar
    Mariusz
    Community Champion

    Hi Anonymous 

    You can add this two columns to yourTable.

     

    FTD = CALCULATE(
        MIN(yourTable[Deposit Date]),
        ALLEXCEPT(yourTable, yourTable[Client])
    )
    FTD (YES/NO) = 
    IF(yourTable[Deposit Date] = yourTable[FTD], "YES", "NO")

    Regards,
    Mariusz

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

    • Mariusz's avatar
      Mariusz
      Community Champion

      Hi Anonymous 

      Actualy FIRSTDATE would be better as it will find first nonblanc date.

      FTD = CALCULATE(
          FIRSTDATE(yourTable[Deposit Date]),
          ALLEXCEPT(yourTable, yourTable[Client])
      )

      Regards,
      Mariusz

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