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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
SMBM
Frequent Visitor

Creating Calculated Column with Related Table and DATEADD

I have a dimensions table that contains a list of all skus in a system.  One of the dimensions is the date that the sku was introduced.  It has a relationship with a fact table that has all transactions of all of those materials.  This includes the billing date.  I have two needs.  The first is a calculated column that records the revenue from a transaction if it happened after the date the sku was publicly introduced (we have transactions that happened before public introduction).  The second is a calculated column that records the revenue from a transaction if it happened within 1 year of the sku being publicly introduced.  For the first need, I'm using the following and it works exactly as expected:

 
REVENUE_AFTER_INTRODUCTION = IF(AND(RELATED('SKU Data'[INTRODUCTION_TYPE]) = "Public Release",RELATED('Material Data'[INTRODUCTION_DATE])<= 'Transactional Data'[BILLING_DATE]), 'Transactional Data'[REVENUE],blank())
 
 
For the second need, I can't figure out how to shift the INTRODUCTION_DATE by 12 months to compare it to the BILLING_DATE.  When I use DATEADD, it causes and error.  I have tried the following:

REVENUE_WITHIN_12_MONTHS_OF_INTRODUCTION = IF(AND(RELATED('Material Data'[INTRODUCTION_TYPE]) = "Public Release", AND(DATEADD(RELATED('Material Data'[INTRODUCTION_DATE]),12,MONTH)>= 'Transactional Data'[BILLING_DATE], RELATED('Material Data'[INTRODUCTION_DATE])<= 'Transactional Data'[BILLING_DATE])), 'Transactional Data'[REVENUE],blank())

The error there is that the first argument to DATEADD must specify a column.
 
If I swap it to put the DATEADD inside the related like this:

REVENUE_WITHIN_12_MONTHS_OF_INTRODUCTION = IF(AND(RELATED('Material Data'[INTRODUCTION_TYPE]) = "Public Release", AND(RELATED(DATEADD('Material Data'[INTRODUCTION_DATE]),12,MONTH))>= 'Transactional Data'[BILLING_DATE], RELATED('Material Data'[INTRODUCTION_DATE])<= 'Transactional Data'[BILLING_DATE])), 'Transactional Data'[REVENUE],blank())
 
I get the error that RELATED expects a fully qualified column reference as it's argument.
 
Is there any way to accomplish what I'm looking for via a calculated column?  
 
Thank you for any assistance.



1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

@SMBM 

I think it should work if you just add 365 to the [Introduction Date].  Does this give you what you are looking for?

REVENUE_WITHIN_12_MONTHS_OF_INTRODUCTION =
IF (
    AND (
        RELATED ( 'Material Data'[INTRODUCTION_TYPE] ) = "Public Release",
        AND (
            RELATED ( 'Material Data'[INTRODUCTION_DATE] ) + 365 >= 'Transactional Data'[BILLING_DATE],
            RELATED ( 'Material Data'[INTRODUCTION_DATE] ) <= 'Transactional Data'[BILLING_DATE]
        )
    ),
    'Transactional Data'[REVENUE],
    BLANK ()
)

View solution in original post

2 REPLIES 2
jdbuchanan71
Super User
Super User

@SMBM 

I think it should work if you just add 365 to the [Introduction Date].  Does this give you what you are looking for?

REVENUE_WITHIN_12_MONTHS_OF_INTRODUCTION =
IF (
    AND (
        RELATED ( 'Material Data'[INTRODUCTION_TYPE] ) = "Public Release",
        AND (
            RELATED ( 'Material Data'[INTRODUCTION_DATE] ) + 365 >= 'Transactional Data'[BILLING_DATE],
            RELATED ( 'Material Data'[INTRODUCTION_DATE] ) <= 'Transactional Data'[BILLING_DATE]
        )
    ),
    'Transactional Data'[REVENUE],
    BLANK ()
)

Holy crap.  Talk about overcomplicating something with an elegantly simple solution.  This did the trick!  Thanks a bunch for the help.  Marked as solution!

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.