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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
mrg64
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
v-piga-msft
Resident Rockstar
Resident Rockstar

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.

View solution in original post

4 REPLIES 4
v-piga-msft
Resident Rockstar
Resident Rockstar

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.
Anonymous
Not applicable

Hello I have followed the formula but the result shows negative 

marielf_0-1636039061143.png

 

mrg64
Frequent Visitor

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

You have aposterphies instead of commas.. 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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