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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
DanielPasalic
Helper II
Helper II

Date Function - DAX - New column in Data Table

Hi
I'm creating Date function (year and month) in Date view (not Query) with DAX like below:
Year = Year (Reference to the table [specific column consisting dates]) 
I get the Year (only) from that column and it is ok. However, in modelling I see that Data type is Whole Number same as the format and if I change to date (like the columns where dates are) that it change different value - 1905 (not the years as they should be). 
Another interesting thing is when I go to my Query, I can not see even this column created?

 

What is the problem?DAX - New column Data table.JPGCreating new column in Query.JPGView in Query.JPG

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

@DanielPasalic 

it is not such interesting as you think.

 

1. DAX calculated columns and measures aren't available in query mode. But Custom columns from Power query mode are available in DAX. DAX is the business logic lnguage, not data shaping

2. YEAR() function gets you integer and it is a whole number

3. if you want to return whole number into date, date wll be calculated as 1900+ Whole Number DAYS. so 2012 days is exactly 5 years + something

 

do not hesitate to give a kudo to useful posts and mark solutions as solution

LinkedIn

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

2 REPLIES 2
az38
Community Champion
Community Champion

@DanielPasalic 

it is not such interesting as you think.

 

1. DAX calculated columns and measures aren't available in query mode. But Custom columns from Power query mode are available in DAX. DAX is the business logic lnguage, not data shaping

2. YEAR() function gets you integer and it is a whole number

3. if you want to return whole number into date, date wll be calculated as 1900+ Whole Number DAYS. so 2012 days is exactly 5 years + something

 

do not hesitate to give a kudo to useful posts and mark solutions as solution

LinkedIn

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Great, thanks a lot for the explanation @az38 
Now I understand how does this works! 

 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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