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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
gauravnarchal
Post Prodigy
Post Prodigy

IF date is greater than other date

Hello

 

I need to calculate the measure.  If the Txn Date is greater than the Invoice Date mark it as "failed" otherwise "passed".

 

DATA

 

Table 1

 

Invoice IDInvoice NumberInvoice Date
11234501-Oct-22
21237003-Oct-22
31239505-Oct-22
41242007-Oct-22
51244509-Oct-22
61247011-Oct-22
71249513-Oct-22
81252015-Oct-22

 

Table 2

Invoice IDInvoice txn IDTxn Date
12244502-Oct-22
22244704-Oct-22
22244903-Oct-22
38789005-Oct-22
487890707-Oct-22
487890907-Oct-22
51290909-Oct-22
6122133111-Oct-22
71333113313-Oct-22
8323412113-Oct-22

 

Result

 

Invoice NumberInvoice txn IDInvoice DateTxn DateStatus
12345224451-Oct-2202-Oct-22Failed
12370224473-Oct-2204-Oct-22Failed
12370224493-Oct-2203-Oct-22Passed
12395878905-Oct-2205-Oct-22Passed
124208789077-Oct-2207-Oct-22Passed
124208789097-Oct-2207-Oct-22Passed
12445129099-Oct-2209-Oct-22Passed
12470122133111-Oct-2211-Oct-22Passed
124951333113313-Oct-2213-Oct-22Passed
12520323412115-Oct-2213-Oct-22Passed

 

1 ACCEPTED SOLUTION
v-tangjie-msft
Community Support
Community Support

Hi @gauravnarchal ,

 

According to your description, here are my steps you can follow as a solution.

(1) We can create  a measure in Table2.

 

Measure = MAXX(FILTER(Table1,Table1[Invoice ID]=SELECTEDVALUE(Table2[Invoice ID])),Table1[Invoice Date])

 

(2)Then we can create  a measure in Table1.

 

Status = IF(SELECTEDVALUE(Table2[Txn Date])>[Measure],"failed","passed")

 

(3) Filter [Measure] and the result is as follows.

Picture1.png

 

Best Regards,

Neeko Tang

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

1 REPLY 1
v-tangjie-msft
Community Support
Community Support

Hi @gauravnarchal ,

 

According to your description, here are my steps you can follow as a solution.

(1) We can create  a measure in Table2.

 

Measure = MAXX(FILTER(Table1,Table1[Invoice ID]=SELECTEDVALUE(Table2[Invoice ID])),Table1[Invoice Date])

 

(2)Then we can create  a measure in Table1.

 

Status = IF(SELECTEDVALUE(Table2[Txn Date])>[Measure],"failed","passed")

 

(3) Filter [Measure] and the result is as follows.

Picture1.png

 

Best Regards,

Neeko Tang

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

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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