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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
gauravnarchal
Post Prodigy
Post Prodigy

If statement (Dates)

I need help to create a calculated column in Table 1as below

 

If number (Table 1) =  number (Table 2) 

Date (Table 1) Equal too and greator than the Start Date (Table 2)  and all dates that fall within the next 1yr of the start date return Yes, else No. Also If no start date is found then return Error

 

Below is the table

 

Table 1

 

NumberInvoiceNumberDate
13000288616703-01-22 0:00
13000299617206-01-22 0:00
10100300617309-01-22 0:00
1501000BPL83009801-01-22 0:00
13000288BPL84749403-01-22 0:00
1300030284797701-01-22 0:00
1300022484798101-01-22 0:00
10040084808701-01-22 0:00
1300010484812501-01-22 0:00
200210084823901-01-22 0:00
200210084824201-01-22 0:00
130150284837902-01-22 0:00
180270084840802-01-22 0:00
10710084842801-01-22 0:00
70050084848201-01-22 0:00
10450084849001-01-22 0:00
10450084849101-01-22 0:00
10450084849201-01-22 0:00
30410084849301-01-22 0:00
10450084849401-01-22 0:00
10450084849501-01-22 0:00
10450084849701-01-22 0:00
1300031684849801-01-22 0:00
1300031684849901-01-22 0:00
10450084850001-01-22 0:00
10450084850101-01-22 0:00
1300031684850201-01-22 0:00
1300031684850301-01-22 0:00
10450084850401-01-22 0:00
10450084850501-01-22 0:00
10450084850601-01-22 0:00
30410084850701-01-22 0:00
1300028884850801-01-22 0:00
190530084850901-01-22 0:00
30261284851201-01-22 0:00
10450084851301-01-22 0:00
130320084851401-01-22 0:00
10450084851702-01-22 0:00
130150084851801-01-22 0:00
130090084851901-01-22 0:00
130090084852001-01-22 0:00
30261284852101-01-22 0:00
130150084852201-01-22 0:00
80220084852302-01-22 0:00
130150084852802-01-22 0:00
190370084853102-01-22 0:00
180270184853202-01-22 0:00
130180084853301-01-22 0:00
1300031384853402-01-22 0:00
30261284853502-01-22 0:00
30261284853801-01-22 0:00
130320084853901-01-22 0:00
180170084854102-01-22 0:00
10450084854202-01-22 0:00
150100684854402-01-22 0:00
30261284854501-01-22 0:00
1300010684854602-01-22 0:00
1300028884854701-01-22 0:00
150100684854802-01-22 0:00
150100684854902-01-22 0:00
10450084855002-01-22 0:00
150100684855102-01-22 0:00
10450084855202-01-22 0:00
1300023284855302-01-22 0:00
70120184855402-01-22 0:00
10450084855502-01-22 0:00
10450084855602-01-22 0:00
150100684855702-01-22 0:00
40410084855802-01-22 0:00
1300015884855902-01-22 0:00
130020184856002-01-22 0:00
150100684856102-01-22 0:00
110150084856202-01-22 0:00
10450084856702-01-22 0:00
10450084856802-01-22 0:00
150100184856902-01-22 0:00
130150084857002-01-22 0:00
150100684857102-01-22 0:00
150100684857202-01-22 0:00
150100684857302-01-22 0:00
150100184857402-01-22 0:00
130150084857602-01-22 0:00
10450084857702-01-22 0:00
10450084857802-01-22 0:00
110150084857902-01-22 0:00
1300010684858002-01-22 0:00
10450084858102-01-22 0:00
130150284858202-01-22 0:00
1300028884858302-01-22 0:00
130150084858402-01-22 0:00

 

Table 2

 

NumberStart Date
10040001-03-20 0:00
10450001-09-17 0:00
10710001-11-19 0:00
30261201-04-15 0:00
30410001-01-20 0:00
404100 
70050001-12-12 0:00
70120101-08-13 0:00
80220001-06-18 0:00
110150001-11-16 0:00
130020101-01-21 0:00
130090001-04-19 0:00
130150001-12-14 0:00
130150201-12-14 0:00
130180001-07-14 0:00
130320001-03-19 0:00
150100001-01-18 0:00
150100101-01-18 0:00
150100601-01-18 0:00
180170001-11-15 0:00
180270001-07-20 0:00
180270101-07-20 0:00
190370001-02-15 0:00
190530001-05-19 0:00
200210001-11-19 0:00
1010030001-01-00 0:00
1300010401-01-21 0:00
1300010601-01-21 0:00
1300015801-01-21 0:00
1300022401-01-21 0:00
1300023201-01-21 0:00
1300028801-05-21 0:00
1300029901-03-17 0:00
13000302 
1300031301-01-07 0:00
1300031601-01-07 0:00
1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

Column = SWITCH(TRUE(),ISBLANK(RELATED('Table 2'[Start Date])),"Error",'Table 1'[Date]<RELATED('Table 2'[Start Date]),"No",'Table 1'[Date]>EDATE(RELATED('Table 2'[Start Date]),12),"No","Yes")

 

Note: Tables are joined via [Number].  See attached.

View solution in original post

1 REPLY 1
lbendlin
Super User
Super User

Column = SWITCH(TRUE(),ISBLANK(RELATED('Table 2'[Start Date])),"Error",'Table 1'[Date]<RELATED('Table 2'[Start Date]),"No",'Table 1'[Date]>EDATE(RELATED('Table 2'[Start Date]),12),"No","Yes")

 

Note: Tables are joined via [Number].  See attached.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors