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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
bkuhlmann
Frequent Visitor

DateAdd Not Working As Expected

Hi Everyone - I'm using DATEADD to compare current QTD values against QTD values from the prior year. The SQLBI article linked below indicates that I should be able to breakout last year's QTD figures by month. While my formula is correctly returning the total value, when I try to break it out by month each month shows the same number

 

Differences between DATEADD and PARALLELPERIOD in DAX - SQLBI

 

My 2 tables are Calendar_CreateDate and Opportunity and they are joined in a bi-directional relationship, so I'm using CROSSFILTER to make it oneway for this measure bc DATEADD will not work otherwise. I'm using CALCULATETABLE to filter the calendar table to result all the dates from the start of the current quarter until today.

 

Prior Year (QTD)2 = 
CALCULATE(
    SELECTEDMEASURE(), 
    DATEADD(
        CALCULATETABLE(
            VALUES(Calendar_CreateDate[Create Date]), 
            CROSSFILTER(Opportunity[Opp Create Date],Calendar_CreateDate[Create Date], OneWay), 
            Calendar_CreateDate[Flag: CFQ (Create Date)] = "Y", 
            Calendar_CreateDate[Create Date] <= TODAY()
        ), 
        -1,
        YEAR
    )
)

 

Here is the result:

bkuhlmann_0-1710509903518.png

 
How come this isn't working for me?
4 REPLIES 4
Greg_Deckler
Community Champion
Community Champion

@bkuhlmann You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000

Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...



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...

Thanks Greg! I almost have your "Hard Way" working for me, but I'm struggling to return the correct MaxYear...I don't want the max year from the calendar table, rather I want the current year. I'm trying to filter the table to return the current year from my calendar table by using filtering it down based on Create Date = TODAY() but I'm struggling to return a single value to the variable. I've tried numerous functions to no avail. Thanks in advance!

@bkuhlmann Why not just Create Year = YEAR(TODAY()) 

or am I missing something?



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...

I was trying to use my calendar table because our fiscal year does not match our calendar year, and I also need to get both the FY and FQ. I could recreate those formulas in the measure but would prefer to pull from the calendar table instead.

 

Is there a way to get the FY and FQ for "today" from my calendar table instead?

Thanks for your help!

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.