Forum Discussion
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?
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:
- Anonymous6 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!
19 Replies
- PaulDBrown
Community Champion
Anonymous
The answer is yes...but what values are you trying to look for? Dates (since you mention dates column...)?
- AnonymousNot applicable
I am trying to find if the policy exists last year based off this single table.
Policy Number
Policy Effective Date Written Premium NEW Named Insured POLICY1 1/1/2019 240,781 COMPANY1 POLICY2 1/1/2019 65,649 COMPANY2 - PaulDBrown
Community Champion
Anonymous
Try this to identify policies present this year but not last year:
Let your table be "Data Table":
Policies not in Last Year = VAR PoliciesThisYear = CALCULATETABLE(VALUES(Data Table [Policy Number]), FILTER( Data Table, YEAR(Data Table[Policy Effective Date]) = YEAR(TODAY()))) VAR PoliciesLastYEAR = CALCULATETABLE(VALUES(Data Table [Policy Number]), FILTER( Data Table, YEAR(Data Table[Policy Effective Date]) = YEAR(TODAY())-1)) RETURN COUNTROWS( EXCEPT(PoliciesThisYear, PoliciesLastYear)And add this measure to a table with the Policy Number as a row.
Does it work?