Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
PowerPaddy
Frequent Visitor

Variable Date Measure - Insurance


Hello, this is a simplified version of what i'm trying to acheive:

In insurance you "earn" a premium proportionately over the lifetime of the policy.
Our policyFact table has a row for each policy with the WrittenPremium, StartDate, EndDate, etc.

To calculate the earnings as at today (valuation date) I have added a column with this code (pseudo):


Earnings =
   [Prem] *
       DIVIDE(
                   (DATEDIFF([StartDate], [ValuationDate],Day)+1),
                   (DATEDIFF([StartDate], [EndDate],Day)+1)
                   )

 

 

Where [ValuationDate] is a measure: =today()

 

This essentially multiplies the Premium by a fraction depending on how many days into the policy it is.

I have Measure which then sums this column called Total Earnings.

In my DateTable, I want to be able to be able to display the Total Earnings as at each date in the table, so [ValuationDate] becomes a variable. Does anyone know how I go about this please?

Many thanks for your help!

2 ACCEPTED SOLUTIONS
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @PowerPaddy,

 

According to your description above, you should be able to use the formula below to create a new measure to calculate the Total Earnings for each date in the date table, and show it with the Date column of DateTable on Chart on the report in your scenario. Smiley Happy

Measure For Total Earnings =
VAR currentDate =
    MAX ( DateTable[Date] )
RETURN
    SUMX (
        policyFact,
        IF (
            currentDate >= [StartDate],
            [Prem]
                * DIVIDE (
                    ( DATEDIFF ( [StartDate], currentDate, DAY ) + 1 ),
                    ( DATEDIFF ( [StartDate], currentDate, DAY ) + 1 )
                )
        )
    )

 

Regards

View solution in original post

Hi @PowerPaddy,

 

Great to hear the problem got resolved! Could you accept my reply above as solution to close this thread? Smiley Happy

 

Regards

View solution in original post

3 REPLIES 3
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @PowerPaddy,

 

According to your description above, you should be able to use the formula below to create a new measure to calculate the Total Earnings for each date in the date table, and show it with the Date column of DateTable on Chart on the report in your scenario. Smiley Happy

Measure For Total Earnings =
VAR currentDate =
    MAX ( DateTable[Date] )
RETURN
    SUMX (
        policyFact,
        IF (
            currentDate >= [StartDate],
            [Prem]
                * DIVIDE (
                    ( DATEDIFF ( [StartDate], currentDate, DAY ) + 1 ),
                    ( DATEDIFF ( [StartDate], currentDate, DAY ) + 1 )
                )
        )
    )

 

Regards

Thanks very much, worked a treat!
Looks pretty obvious once you know how.

Hi @PowerPaddy,

 

Great to hear the problem got resolved! Could you accept my reply above as solution to close this thread? Smiley Happy

 

Regards

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors