Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

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
1 ACCEPTED SOLUTION
Mariusz
Community Champion
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.

View solution in original post

2 REPLIES 2
Mariusz
Community Champion
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
Community Champion
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.

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.