Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Count items in table A if filter date from table B falls between start & end date from table B

How to count the distinct serial number in table A if filter date from table B falls between start & end date from table B? I want to calculate the total count of serial number of Table B + count of...
  • v-xuding-msft's avatar
    v-xuding-msft
    6 years ago

    Hi Anonymous ,

     

    Please try this:

    Serial Number in TA 1 =
    VAR t =
        FILTER (
            TableA,
            TableA[Start Date] <= MIN ( 'Created date from table B'[Created Date] )
                && TableA[End Date] >= MAX ( 'Created date from table B'[Created Date] )
        )
    RETURN
        COUNTROWS ( t )
    
    Serial Number in TB 1 =
    VAR t =
        FILTER (
            TableA,
            TableA[Start Date] <= MIN ( 'Created date from table B'[Created Date] )
                && TableA[End Date] >= MAX ( 'Created date from table B'[Created Date] )
        )
    RETURN
        COUNTROWS ( FILTER ( t, [Serial Number] IN VALUES ( TableB[Serial Number] ) ) )