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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
flyfisher63
Regular Visitor

Add custom column to existing table by offsetting rate column by 1 year

I have table in BI that has all our clients data and I am having a hard time creating a column called Prior Year Rate.

 

I have the following table except for the Prior Year Rate.

 

The 1st 3 columns are from the dataset, I added Expected Renewal Date as a calculated column of Expiration Date +1.

 

I have tried to add the Prior Year Rate but cannot find a way to do it. Its probably a simple solutions that is just escaping me.

 

Thanks for any help

 

PolicyholderEffective DateExpiration DateExpected Renewal DateCurrent Year RatePrior Year Rate
ABC Co1/1/202412/31/20241/1/202556.24 
ABC Co1/1/202512/31/20251/1/202660.3556.24
 
1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@flyfisher63 Try this:

Prior Year Rate Measure =
  VAR __PolicyHolder = MAX( 'Table'[PolicyHolder] )
  VAR __Date = MAX( 'Table'[Effective Date] )
  VAR __PreviousDate = 
    MAXX( 
      FILTER( 
        ALL( 'Table' ), 
        [Policyholder] = __Policyholder &&
        [Effective Date] < __Date 
      ), 
      [Effective Date] 
    )
  VAR __Result = 
    MAXX( 
      FILTER( 
        ALL( 'Table' ), 
        [Policyholder] = __Policyholder &&
        [Effective Date] = __PreviousDate 
      ), 
      [Current Year Rate] 
    )
RETURN
  __Return

 

As a calculated column:

Prior Year Rate Measure =
  VAR __PolicyHolder = [PolicyHolder]
  VAR __Date = [Effective Date]
  VAR __PreviousDate = 
    MAXX( 
      FILTER( 
        ALL( 'Table' ), 
        [Policyholder] = __Policyholder &&
        [Effective Date] < __Date 
      ), 
      [Effective Date] 
    )
  VAR __Result = 
    MAXX( 
      FILTER( 
        ALL( 'Table' ), 
        [Policyholder] = __Policyholder &&
        [Effective Date] = __PreviousDate 
      ), 
      [Current Year Rate] 
    )
RETURN
  __Return


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

5 REPLIES 5
samratpbi
Super User
Super User

Hi, As @Greg_Deckler mentioned, you can create the measure or a calculated column. In adition, if you need to have previous row value simply in a visual, then you can use Visual Calculation also.

samratpbi_0-1760046855708.png

 

in the visual calculation, you can use PREVIOUS function.

samratpbi_1-1760046969996.png

 

Hope this helps.

If this helps to resolve your problem, then please mark it as solution.

Thanks - Samrat

Hi @flyfisher63 

Just checking in to see if the previous response helped resolve your issue. If not, feel free to share your questions and we’ll be glad to assist.

Hi @flyfisher63 

Have you had a chance to look through the responses shared earlier? If anything is still unclear, we’ll be happy to provide additional support.

lbendlin
Super User
Super User

Please specify if you want that as Power Query code, as a calculated column, or as a measure.

Greg_Deckler
Community Champion
Community Champion

@flyfisher63 Try this:

Prior Year Rate Measure =
  VAR __PolicyHolder = MAX( 'Table'[PolicyHolder] )
  VAR __Date = MAX( 'Table'[Effective Date] )
  VAR __PreviousDate = 
    MAXX( 
      FILTER( 
        ALL( 'Table' ), 
        [Policyholder] = __Policyholder &&
        [Effective Date] < __Date 
      ), 
      [Effective Date] 
    )
  VAR __Result = 
    MAXX( 
      FILTER( 
        ALL( 'Table' ), 
        [Policyholder] = __Policyholder &&
        [Effective Date] = __PreviousDate 
      ), 
      [Current Year Rate] 
    )
RETURN
  __Return

 

As a calculated column:

Prior Year Rate Measure =
  VAR __PolicyHolder = [PolicyHolder]
  VAR __Date = [Effective Date]
  VAR __PreviousDate = 
    MAXX( 
      FILTER( 
        ALL( 'Table' ), 
        [Policyholder] = __Policyholder &&
        [Effective Date] < __Date 
      ), 
      [Effective Date] 
    )
  VAR __Result = 
    MAXX( 
      FILTER( 
        ALL( 'Table' ), 
        [Policyholder] = __Policyholder &&
        [Effective Date] = __PreviousDate 
      ), 
      [Current Year Rate] 
    )
RETURN
  __Return


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.