cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ajaikumar
Regular Visitor

DAX is not identifying the date fields

I'm trying to get the number of days between two dates. For that, I tried to use the DATEDIFF function but the date fields are not showing up in IntelliSense and if I try to enter it manually it shows an error that is in the figure below:

Screenshot 2023-01-08 231842.png

 

Please let me know what is wrong with this expression. Thanks in advance.

1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @Ajaikumar ,

As checked your screenshot, what you are trying to create is a measure. That is the cause of problem. This errror can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result. You can review the following blog for more details.

DAX error messages in Power BI

yingyinr_0-1673331764653.png

And the solution is that you can create a calculated column as below to replace this measure...

 

R value = DATEDIFF ( calendar[Date], TODAY (), DAY )

 

yingyinr_1-1673332092675.png

In addition, you can refer the following blog to get the difference between two dates.

Power bi Date Difference

yingyinr_1-1673332705332.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yiruan-msft
Community Support
Community Support

Hi @Ajaikumar ,

As checked your screenshot, what you are trying to create is a measure. That is the cause of problem. This errror can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result. You can review the following blog for more details.

DAX error messages in Power BI

yingyinr_0-1673331764653.png

And the solution is that you can create a calculated column as below to replace this measure...

 

R value = DATEDIFF ( calendar[Date], TODAY (), DAY )

 

yingyinr_1-1673332092675.png

In addition, you can refer the following blog to get the difference between two dates.

Power bi Date Difference

yingyinr_1-1673332705332.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you for the solution @v-yiruan-msft 

tamerj1
Super User
Super User

Hi @Ajaikumar 

perhaps you're trying to create a new Calculated Column but in fact you created a Measure instead

Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Top Solution Authors
Top Kudoed Authors