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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

USERELATIONSHIP with MIN date not working as expected

 

Hi,

I have two tables Dim_Date and Fact_Inventory, they have Active relationship based on Dim_Date(DateSK) and Fact_Inventory(ReceivedDate_DateSK) and Inctive relationship based on Dim_Date(DateSK) and Fact_Inventory(ManufactureDate_DateSK).

 

The Active relationship works well, of course. However, when I want to get DateBK

from Dim_Date(DateBK) by the below DAX function to get ManufactureDate:

 

ManufactureDate = CALCULATE(
        MIN(Dim_Date[DateBK]),
        USERELATIONSHIP(Dim_Date[DateSK], Fact_Inventory[ManufacturedDate_DateSK])
)
 and it returns DataBK based on the Active relationship "Dim_Date(DateSK) and Fact_Inventory(ReceivedDate_DateSK)" but not the expecting Inactive relationship "Dim_Date(DateSK) and Fact_Inventory(ManufactureDate_DateSK)".
 

DateBK column is type Date (not DateTime)

 

(DateSK = Date Surrogate Key,  DataBK = Date Business Key)

 

Screenshots 
Describe the situation
peternznguyen_0-1680900912531.png

 

 and not expecting result

peternznguyen_2-1680901628125.png

==>The ManufactureDate should return 2023-04-05 based on its ManufactureDate_DateSK 20230405, but it returns 2023-04-07 that is same as ReceivedDate

 

 

Please help me out

Thank you in advance.

Peter

 

 

 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

Please update the formula of measure [ManufactureDate ] as below and check if you can get the expected result... Please find the details in the attachment.

ManufactureDate =
CALCULATE (
    MIN ( 'Fact_Inventory'[ManufactureDate_DateSK] ),
    FILTER (
        'Fact_Inventory',
        'Fact_Inventory'[ReceivedDate_DateSK]
            = SELECTEDVALUE ( 'Fact_Inventory'[ReceivedDate_DateSK] )
    )
)

vyiruanmsft_0-1681094117884.png

Best Regards

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Anonymous ,

Please update the formula of measure [ManufactureDate ] as below and check if you can get the expected result... Please find the details in the attachment.

ManufactureDate =
CALCULATE (
    MIN ( 'Fact_Inventory'[ManufactureDate_DateSK] ),
    FILTER (
        'Fact_Inventory',
        'Fact_Inventory'[ReceivedDate_DateSK]
            = SELECTEDVALUE ( 'Fact_Inventory'[ReceivedDate_DateSK] )
    )
)

vyiruanmsft_0-1681094117884.png

Best Regards

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors