Forum Discussion

ElkanaTheGreat's avatar
ElkanaTheGreat
Frequent Visitor
7 years ago
Solved

Dynamically link earned premiums table to policy table

In insurance it is useful to see the premium that is being earned over a given period. For example if an insurance policy is sold for $1000 a year it will earn $2.74 every day.   I want to be able ...
  • LivioLanzo's avatar
    LivioLanzo
    7 years ago

    ElkanaTheGreat

     

    Try this new file which is grouped by month:

     

    https://1drv.ms/u/s!AiiWkkwHZChHjylF131vK9FcAbY9

     

    The new grouped table can be generated like this:

     

     

    PremiumsMonthly =
    SELECTCOLUMNS (
        ADDCOLUMNS (
            GENERATE (
                Table1,
                VAR PolStart = Table1[policystart]
                VAR PolEnd = Table1[policyend]
                RETURN
                    GENERATESERIES (
                        1,
                        DATEDIFF ( EOMONTH ( PolStart0 )EOMONTH ( PolEnd0 )MONTH ) + 1
                    )
            ),
            "Days"1
                + MIN ( Table1[policyend], EOMONTH ( Table1[policystart], [Value] - 1 ) )
                - MAX ( EOMONTH ( Table1[policystart], [Value] - 2 ) + 1, Table1[policystart] ),
            "Month"EOMONTH ( Table1[policystart], [Value] - 1 )
        ),
        "PolicyNumber", Table1[PolicyNumber],
        "Premium", Table1[PremiumPerDay] * [Days],
        "VehicleType", Table1[Vehicle Type],
        "MonthDate", [Month],
        "Days", [Days]
    )