cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mrg64 Frequent Visitor
Frequent Visitor

Calculating Days Between a Date and Today

I am trying to calculate the days between a date and today but I don't succed...

 

I've created a new column : 

DaysInWarehouse = DATEDIFF('caapps PackageHeader (2)'[WarehouseInDate];TODAY();DAY)

And I've got the following result:

WarehouseInDate   DaysInWarehouse

2018-04-04                    0

2018-04-03                  20

2018-03-29                 126

2018-03-28                 238

 

What am I doing wrong?

 

Thanks in advance

// magnus

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Calculating Days Between a Date and Today

Hi @mrg64,

 

I have made a test by entering the date and creating the Calculated Column with your dax expression in Power BI Desktop (Version: 2.56.5023.942 64-bit (March 2018)), everything works as expected.

 

Capture.PNG

 

Please check if you have update to the latest Power BI Desktop and have a try.

 

What data source have you connected with and  how to connected it?

 

If you connected  by Direct Query, there should be some limitations.

 

  • Limitations in calculated columns: Calculated columns are limited to being intra-row, as in, they can only refer to values of other columns of the same table, without the use of any aggregate functions. Additionally, the DAX scalar functions (such as LEFT()) that are allowed, will be limited to those which can simply be pushed to the underlying source, hence will vary depending upon the exact capabilities of the source. Functions that are not supported will not be listed in autocomplete when authoring the DAX for a calculated column, and would result in an error if used.

 

If you need additional help , please share your data structure.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 REPLIES 2
mrg64 Frequent Visitor
Frequent Visitor

Calculating number of days between today and a date

I'am trying do calculate number of days between today and a date but I don't succed...

I've created a column and defined number of days like this:

DaysInWarehouse = DATEDIFF('caapps PackageHeader (2)'[WarehouseInDate];TODAY();DAY)

I've got the following result:

WarehouseInDate     DaysInWarehouse

2018-04-04                        0

2018-04-03                       20

2018-03-29                      126

2018-03-28                      238

..........

 

What am I doing wrong?

 

Thanks in advance

// magnus

Community Support Team
Community Support Team

Re: Calculating Days Between a Date and Today

Hi @mrg64,

 

I have made a test by entering the date and creating the Calculated Column with your dax expression in Power BI Desktop (Version: 2.56.5023.942 64-bit (March 2018)), everything works as expected.

 

Capture.PNG

 

Please check if you have update to the latest Power BI Desktop and have a try.

 

What data source have you connected with and  how to connected it?

 

If you connected  by Direct Query, there should be some limitations.

 

  • Limitations in calculated columns: Calculated columns are limited to being intra-row, as in, they can only refer to values of other columns of the same table, without the use of any aggregate functions. Additionally, the DAX scalar functions (such as LEFT()) that are allowed, will be limited to those which can simply be pushed to the underlying source, hence will vary depending upon the exact capabilities of the source. Functions that are not supported will not be listed in autocomplete when authoring the DAX for a calculated column, and would result in an error if used.

 

If you need additional help , please share your data structure.

 

Best Regards,

Cherry

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