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

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])

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])

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.