Forum Discussion

Spotto's avatar
Spotto
Icon for Helper IV rankHelper IV
2 years ago

Minimum with three related tables

hi guys, 

I have 3 related columns and I need to bring the minimum date from the PENDING DATE column in table PENDING

 

RESULT (example):

 

table CONTRACT:

PDDMCT

LINHA

ID_CONTRACT

 

table PAYMENT

ID_CONTRACT

ID_PAYMENT

Payment_Date

 

table PENDING

ID_PAYMENT

PENDING_DATE

 

Is it possible to create a measure that brings the minimum PENDING_DATE by PDDMCT?

 

TKS for help 🙂

3 Replies

  • PijushRoy's avatar
    PijushRoy
    Icon for Community Champion rankCommunity Champion
    Calculate(
    MIN(
    'PENDING'[Pending_Date]),
    FILTER(
    FILTER(
    Related( first condition as per data model)),
    Related( second condition as per data model))
    )

     

    Please try this, change the DAX as per your data model.
    If you solve, post sample data and image for your data model

    If solve your requirement, please ACCEPT AS SOLUTION

    • Spotto's avatar
      Spotto
      Icon for Helper IV rankHelper IV

       PijushRoy Thanks for your help, but it didn't work 😞, could you give more details?

  • smpa01's avatar
    smpa01
    Icon for Community Champion rankCommunity Champion

    Spotto  can you try this

    Measure = CALCULATE (
        MIN ( PENDING[PENDING_DATE] ),
        FILTER (
            ALL ( PENDING ),
            PENDING[ID_PAYMENT]
                = CALCULATE (
                    MIN ( PENDING[ID_PAYMENT] ),
                    ALL ( PAYMENT ),
                    VALUES ( PAYMENT[ID_CONTRACT] )
                )
        )
    )