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! Request now

Reply
Anonymous
Not applicable

Created Column: Return value if date from one table is between two dates in another table

Hi,

 

I need to create a column that will return 'HPP_PlanYears_Crosswalk'[PlanYear] when 'ClaimData'[IncurredFrom] is between 'HPP_PlanYears_Crosswalk'[PlanYearStart] and 'HPP_PlanYears_Crosswalk'[PlanYearEnd] AND where 'HPP_PlanYears_Crosswalk'[GroupID]'ClaimData'[GroupID]

 

'ClaimData'[IncurredFrom], 'HPP_PlanYears_Crosswalk'[PlanYearStart], 'HPP_PlanYears_Crosswalk'[PlanYearEnd] are already formatted as dates.

 

Can you please assist me?  I found a few example threads posted but none were exactly what I needed.

 

 

 

Thank you,

Andrew

1 ACCEPTED SOLUTION

if you changed the plan  year to max it probably would have worked, i see you changed it, but you have an iterator ie Maxx, do you specifically  need an iterator as they are more performance hungry.





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
vanessafvg
Super User
Super User

try this?

Plan Year =
VAR groupid =
    SELECTEDVALUE ( 'ClaimData'[GroupID] )
VAR result =
    CALCULATE (
        'HPP_PlanYears_Crosswalk'[PlanYear],
        'ClaimData'[IncurredFrom] >= 'HPP_PlanYears_Crosswalk'[PlanYearStart]
            && 'ClaimData'[IncurredFrom] <= 'HPP_PlanYears_Crosswalk'[PlanYearEnd]
            && 'HPP_PlanYears_Crosswalk'[GroupID] = groupid
    )
RETURN
    result





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Anonymous
Not applicable

This is close to what I need but I am getting an error with your DAX.  I tried to resolve it but couldn't get your solutuon to work.

 

The error reads:  The expression contains columns from multiple tables, but only columns from a single table can be used in a True/False expression that is used as a table filter expression.

 

Capture.PNG

if you changed the plan  year to max it probably would have worked, i see you changed it, but you have an iterator ie Maxx, do you specifically  need an iterator as they are more performance hungry.





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Anonymous
Not applicable

This is what I needed:

 

Corrected_PlanYear =
VAR _Date = ( ClaimData[IncurredFrom] )
VAR _ID = ( ClaimData[GroupID] )
VAR _PY =
MAXX (
FILTER (
PlanYears_Crosswalk,
PlanYears_Crosswalk[GroupID] = _ID &&
_Date >= PlanYears_Crosswalk[PlanYearStart] &&
_Date <= PlanYears_Crosswalk[PlanYearEnd]
),
[PlanYear]
)
RETURN
_PY

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