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
Loubot3000
Resolver II
Resolver II

Compare date table with another unrelated date table

I'm using a slicer that uses an unrelated date table to set the maximum date of the main date table, without filtering that main table to a single month (like what would happen if the slicer were using the main date table instead).

 

However, since they're unrelated, the date comparison ( Datetable1 <=  Selected(DateTable2) ) won't work.

 

This is my code for a calculated column, which will be put into a table:

 

------------------------------------------------------------------------------

 

Test 2 (filtered date column) =

VAR currMonth =
    SELECTEDVALUE('Independent Date Table'[Date])
// Recalculated for every date selection.

VAR currPeriod =
    FILTER(
        ALLSELECTED(Sheet1[Period - month]),
        Sheet1[Period - month] <= currMonth
    )
// ALLSELECTED() Excludes months that are missing within the context (e.g. months measured quarterly) - causing it to be non-consecutive.

RETURN currPeriod
 
---------------------------------------------------------------------
 
The bit in red seems to not be evaluating correctly, it seems to just be returning false for everything, and therefore returning a blank table.
 
I have tried adding an inactive relationship between the two date columns, and then using USERELATIONSHIP() to activate it just during the calculation, like so:

--------------------------------------------------------------------
Test 2 (filtered date column) =

VAR currMonth =
    SELECTEDVALUE('Independent Date Table'[Date])
// Recalculated for every date selection.

VAR currPeriod =
    FILTER(
        ALLSELECTED(Sheet1[Period - month]),
        CALCULATE(SELECTEDVALUE(Sheet1[Period - month]) <= currMonth,
        USERELATIONSHIP(Sheet1[Period - month], 'Independent Date Table'[Date]))
    )
/*ALLSELECTED() Excludes months that are missing within the context (e.g. months measured quarterly) - causing it to be non-consecutive.
USERELATIONSHIP() activates the relationship with the independent date table just for this calculation, so that the date comparison can work. */

RETURN currPeriod

-------------------------------------------------------------------

However this still returns a blank column.

What am I doing wrong? Is there a better way to do this?
2 REPLIES 2
BITomS
Solution Supplier
Solution Supplier

Hi @Loubot3000 ,

 

Have you tried the LOOKUPVALUE expression? : https://learn.microsoft.com/en-us/dax/lookupvalue-function-dax

How would you suggest using it in this context?

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