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
shanipowerbi
Helper III
Helper III

Last Invoice Payment Status

Hi Experts I need your help.

 

I have two tables in which 1st table named "Invoice Data" containing columns (User IDs not Unique)

Date / User ID/ Amount / Invoice ID / Payment Status (Paid or Unpaid)

 

My 2nd table "User Data contains columns (User IDs Unique)

User ID / User Conversion Date / Channel

 

I have made a relationship b/w User IDs, actually, I need the Last Payment status (Paid or Unpaid) in my 2nd table.

1 ACCEPTED SOLUTION

Hi @shanipowerbi ,

 

We can use a measure or a calculate column to meet your requirement.

 

1. Create a measure like this,

 

Last Payment Measure = 
var _maxdate = CALCULATE(MAX('Table 1'[Date]),FILTER(ALLSELECTED('Table 1'),'Table 1'[User ID]=MAX('Table 1'[User ID])))
return
CALCULATE(MAX('Table 1'[Payment Status]),FILTER('Table 1','Table 1'[Date]=_maxdate))

 

La1.jpg

 

2. Create a calculate column in Table 2 like this,

 

Column = 
var _maxdate = CALCULATE(MAX('Table 1'[Date]),FILTER('Table 1','Table 1'[User ID]='Table 2'[User ID]))
return
CALCULATE(MAX('Table 1'[Payment Status]),FILTER('Table 1','Table 1'[Date]=_maxdate&&'Table 1'[User ID]='Table 2'[User ID]))

 

La2.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

 

Best regards,

 

Community Support Team _ zhenbw

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

 

BTW, pbix as attached.

View solution in original post

6 REPLIES 6
amitchandak
Super User
Super User

@shanipowerbi , new column in table two

maxx(filter(Table1, Table1[User ID] =Table2[User ID]),lastnonblankvalue(Table1[Date],max(Table1[Payment Status])))

 

 

@amitchandak Formula not working.

 

 

 

 

@amitchandak @FrankAT 

 

This is my table 1

shanipowerbi_0-1597845989821.png

and my second table is one have User IDs in result answer should be "paid" if look July 31 2020

Hi @shanipowerbi ,

 

We can use a measure or a calculate column to meet your requirement.

 

1. Create a measure like this,

 

Last Payment Measure = 
var _maxdate = CALCULATE(MAX('Table 1'[Date]),FILTER(ALLSELECTED('Table 1'),'Table 1'[User ID]=MAX('Table 1'[User ID])))
return
CALCULATE(MAX('Table 1'[Payment Status]),FILTER('Table 1','Table 1'[Date]=_maxdate))

 

La1.jpg

 

2. Create a calculate column in Table 2 like this,

 

Column = 
var _maxdate = CALCULATE(MAX('Table 1'[Date]),FILTER('Table 1','Table 1'[User ID]='Table 2'[User ID]))
return
CALCULATE(MAX('Table 1'[Payment Status]),FILTER('Table 1','Table 1'[Date]=_maxdate&&'Table 1'[User ID]='Table 2'[User ID]))

 

La2.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

 

Best regards,

 

Community Support Team _ zhenbw

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

 

BTW, pbix as attached.

FrankAT
Community Champion
Community Champion

Hi @shanipowerbi 

use a calculated columnin the second table with the following formula:

 

Payment Status (Paid or Unpaid) =RELATED('Invoice Data'[Payment Status (Paid or Unpaid)]

 

Regards FrankAT

@FrankAT its Not working, I need Latest status in 2nd table

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.