Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Finding Values that do not exist last year

Is it possible to find values that do not exist last year, using the date column of the same table?
  • PaulDBrown's avatar
    PaulDBrown
    6 years ago

    Anonymous 

     

    Policies Renewed this year (present in both):

    Renewed Policies = 
    VAR PolTY = CALCULATETABLE(VALUES('DataTable'[Policy Number]);
                FILTER('DataTable';
                YEAR('DataTable'[Policy Effective Date]) = YEAR(TODAY())))
    VAR PolLY = CALCULATETABLE(VALUES('DataTable'[Policy Number]);
                FILTER('DataTable';
                YEAR('DataTable'[Policy Effective Date]) = YEAR(TODAY())-1))
    Return
    COUNTROWS(
        INTERSECT(PolLY; PolTY))

     

    Policies not renewed (present last year but not this year):

    Policies Not in this Year = 
    VAR PolTY = CALCULATETABLE(VALUES('DataTable'[Policy Number]);
                FILTER('DataTable';
                    YEAR('DataTable'[Policy Effective Date]) = YEAR(TODAY())))
    VAR PolLY = CALCULATETABLE(VALUES('DataTable'[Policy Number]);
                FILTER('DataTable';
                    YEAR('DataTable'[Policy Effective Date]) = YEAR(TODAY())-1))
    Return
    COUNTROWS(
        EXCEPT(PolLY; PoltY))

     

    Which gets you this result:

     

  • Anonymous's avatar
    Anonymous
    6 years ago

    I did more research and found that this was able to provide the data i needed.

     

    UnRenewed Policies = 
    VAR PolTY = CALCULATETABLE(VALUES('PY WrittenPremium'[Policy Number]),
                FILTER('PY WrittenPremium',
                    MONTH('PY WrittenPremium'[Policy Effective Date]) = MONTH(TODAY()) &&
                    YEAR('PY WrittenPremium'[Policy Effective Date]) = YEAR(TODAY())           
                ))
    
    VAR PolLY = CALCULATETABLE(VALUES('PY WrittenPremium'[Policy Number]),
                FILTER('PY WrittenPremium',
                    MONTH('PY WrittenPremium'[Policy Effective Date]) = MONTH(TODAY()) &&
                    YEAR('PY WrittenPremium'[Policy Effective Date]) = YEAR(TODAY())-1
                ))
    
    Return
    EXCEPT(PolLY,PolTY)

      Thank you for all your help!