Power Pivot - Day Function

Skovgaard

Board Regular
Joined
Oct 18, 2013
Messages
204
Office Version
  1. 365
Platform
  1. Windows
Hi,

In my Data Model I have a custom column, which calculates a date. I use Date(Year(xxx),Month(xxx),Day(xxx)) to calculate the date.
I'm having trouble with the Day function, which doesn't convert to correct day in month.

I have a table, where the DAY function should pick up a number and then convert it to the day in a month, so the total date is set.
See below, when I only use Related, it picks up 2, when I use DAY it converts it to 1.

Why doesn't the day function convert it to 2?


Below function picks up the number 2
1650461366178.png


Below function returns the number 1
1650461631347.png


/Skovgaard
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
The DAY function expects you to pass it a date. If you pass it the value 2 as you are, it interprets that as 2 days starting from 31/12/1899 since that is how Excel stores dates, which is 1/1/1900 and hence you get 1 as the day number.
 
Upvote 0
The DAY function expects you to pass it a date. If you pass it the value 2 as you are, it interprets that as 2 days starting from 31/12/1899 since that is how Excel stores dates, which is 1/1/1900 and hence you get 1 as the day number.
Thanks for your reply, I was wondering why it behaved differently in Excel and in the Data Model.
However I made a workaround in my DimensionTable, so fixed it in that way.

/Skovgaard
 
Upvote 0
It's odd because according to the DAX documentation, valid dates start at 1 Mar 1900
 
Upvote 0

Forum statistics

Threads
1,223,670
Messages
6,173,722
Members
452,528
Latest member
ThomasE

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top