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
Heidilein
Helper I
Helper I

Measure with DateAdd returns NaN

Hi there,

I`m struggling with the measure dateAdd which delivers NaN, which I don´t understand.

The value in the table which I am searching for looks like this:

Heidilein_0-1695649159125.png

The measure which I am using is

ValuePrevMonth = (CALCULATE([Price], DATEADD(Table[Date],-1, MONTH)))
 
when put next to each other the first entry is there, but the second is shown as NaN
Heidilein_1-1695649258582.png

 

Actually, my understanding was that at least 0 should be returned. There is no calculation or division through zero, so why NaN?

In case of the dateAdd function: which key is used to do a lookup? Do I need an extra mapping to a calendar table?

 

Thanks in advance for any feedback.

 

1 ACCEPTED SOLUTION

@Heidilein , if there is only price and valueprevmonth, there is no way of distinction. For each product the valueprevMonth will be different. If delivery name is added to table visual, the measure will look like this

ChiragGarg2512_1-1695888336899.png

 

 

View solution in original post

7 REPLIES 7
ChiragGarg2512
Solution Sage
Solution Sage

@Heidilein , If [price] is a column, then try changing the dax to 

 

ValuePrevMonth = (CALCULATE(sum('Table'[Price])DATEADD('Table'[Date],-1MONTH)))

 

Thank you

Thanks, but price is already a measure with sum(table[price]), my fault, I should have added this as information.

@Heidilein , Check the data type of date column. The dax seems to work fine

 

ChiragGarg2512_0-1695708452114.png

 

@ChiragGarg2512 The data type of the column is already from kind date. I´m wondering if I need an index or sth like that?

@Heidilein , can some sample data for 10 to 12 rows be provided in tabular form. There shouldn't be a need to create a new column.

@ChiragGarg2512 I think I have found the problem. This is the table how it looks like.

ArticlePriceDeliveryDate
425120300523,04 €Express GmbH TEST01.07.2023
425120300523,05 €Express GmbH TEST01.11.2023
425120300523,06 €Express GmbH01.09.2023
425120300523,07 €Express GmbH01.10.2023
425120300523,08 €Express GmbH TEST01.08.2023

 

I assume the measure cannot find the entry due to the change of the name of the delivery, right? Therefore dateAdd returns NaN because there is no such entry even the date is set. 

@Heidilein , if there is only price and valueprevmonth, there is no way of distinction. For each product the valueprevMonth will be different. If delivery name is added to table visual, the measure will look like this

ChiragGarg2512_1-1695888336899.png

 

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

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.