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
Anonymous
Not applicable

How to get a Date Value from unrelated tables

I have two unrelated tables named TableA and TableB.  I am trying to get the earliest date from TableB into a calculated column in TableA and I keep getting the incorrect date.   I value should be 3/15/2020 but using the formula below I receive 01/15/2020.

 

GetDate = CALCULATE(MIN(TableB[CvPremExpDate]), TREATAS(
SUMMARIZE(
TableA,TableA[PL_POL_NBR],
TableA[PL_LOCATION_NBR],
TableA[PL_RISK_NBR],
TableA[GetMaxEndr]
),
TableB[PL_POL_NBR],
TableB[PL_LOCATION_NBR],
TableB[PL_RISK_NBR],
TableB[CV_ENDR_NBR]))

 

TableA

PL_POL_NBRPL_LOCATION_NBRPL_RISK_NBRRK_VEHICLE_NBRGetMaxENDR
00000151854999996653310
00000151854999996663310
00000151854999996673310
00000151854999996683310
00000151854999996693310
00000151854999996703310
00000151854999996713310
00000151854999996723310
00000151854999996733310
00000151854999996743310

TableB

PL_POL_NBRPL_LOCATION_NBRPL_RISK_NBRCV_ENDR_NBRCvPremExpDate
15185499999665910/8/2020
15185499999665103/15/2020
15185499999666910/8/2020
15185499999666103/15/2020
15185499999667910/8/2020
15185499999667103/15/2020
15185499999668910/8/2020
15185499999668103/15/2020
15185499999669910/8/2020
15185499999669103/15/2020
15185499999670910/8/2020
15185499999670103/15/2020
15185499999671910/8/2020
15185499999671103/15/2020
15185499999672910/8/2020
15185499999672103/15/2020
15185499999673910/8/2020
15185499999673103/15/2020
15185499999674910/8/2020
15185499999674103/15/2020
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Create a new column in tableA


minx(filter(Tableb, Tableb[PL_POL_NBR]=Tablea[PL_POL_NBR] && Tableb[PL_LOCATION_NBR]=Tablea[PL_LOCATION_NBR] && Tableb[PL_RISK_NBR] =Tablea[PL_RISK_NBR]), Tableb[CvPremExpDate])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@Anonymous , Create a new column in tableA


minx(filter(Tableb, Tableb[PL_POL_NBR]=Tablea[PL_POL_NBR] && Tableb[PL_LOCATION_NBR]=Tablea[PL_LOCATION_NBR] && Tableb[PL_RISK_NBR] =Tablea[PL_RISK_NBR]), Tableb[CvPremExpDate])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
ryan_mayu
Super User
Super User

@Anonymous 

please try this

Column = MINX(FILTER(TableB,TableA[PL_POL_NBR]=TableB[PL_POL_NBR]),'TableB'[CvPremExpDate])

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Tried your solution and I get the same incorrect date as my formula.  I get 01/15/2020 instead of 03/15/2020

lbendlin
Super User
Super User

This should work

 

GetDate = CALCULATE(MIN(TableB[CvPremExpDate]), TREATAS(
SELECTCOLUMNS(TableA,
"PL_POL_NBR",TableA[PL_POL_NBR],
"PL_LOCATION_NBR",TableA[PL_LOCATION_NBR]
,"PL_RISK_NBR",TableA[PL_RISK_NBR]
,"CV_ENDR_NBR",TableA[GetMaxENDR]),
TableB[PL_POL_NBR],
TableB[PL_LOCATION_NBR],
TableB[PL_RISK_NBR],
TableB[CV_ENDR_NBR]))
Anonymous
Not applicable

Tried your suggestion and I get the same incorrect date as my original formula.  The date returned is 01/15/2020 when it should be 03/15/2020.

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