Forum Discussion

Jug's avatar
Jug
Frequent Visitor
3 years ago
Solved

Composite key with filter

Hello, I was wondering if you could help me with this question.   I use directquery and I need to relate two tables with a composite key but using a filter in one of the fields, for example:   Th...
  • v-jianboli-msft's avatar
    3 years ago

    Hi Jug ,

     

    Please try:

    Measure = 
    var _a = CALCULATE(MAX('ADDRESS'[UPDATE_DATE]),FILTER(ALL('ADDRESS'),[ID_CLIENT]=MAX('ADDRESS'[ID_CLIENT])))
    return IF(MAX('ADDRESS'[UPDATE_DATE])=_a&&MAX('CLIENT'[CONTRACT_STATUS])="VALID",1,0)

    then apply it to the visual level filter:

    Final output:

     

    Best Regards,

    Jianbo Li

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.