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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
deb_power123
Helper V
Helper V

DAX to extract year and month and day and concatenate it together and substract 100

Hi All,

 

Can some one suggest a DAX by which  i can extract year,month and day from a date say '01-Jan-2021' from dates column and then substract 100 from it.

 

For eg:  I want to extract the numeric value 20210101 from the date '01-Jan-2021 and minus 100 from it using DAX query.

 

Expected output:

100- 20210101 = -20210001

 

Please suggest.

1 ACCEPTED SOLUTION
HashamNiaz
Solution Sage
Solution Sage

Hi @deb_power123 !

You can create a new column based on following DAX;

 

NewColumn = 100 - (YEAR(Table[Date]) & LEFT("0" & MONTH(Table[Date]), 2) & LEFT("0" & DAY(Table[Date]), 2))

 

Hope this will resolve your issue.

 

Regards,

Hasham

 

View solution in original post

1 REPLY 1
HashamNiaz
Solution Sage
Solution Sage

Hi @deb_power123 !

You can create a new column based on following DAX;

 

NewColumn = 100 - (YEAR(Table[Date]) & LEFT("0" & MONTH(Table[Date]), 2) & LEFT("0" & DAY(Table[Date]), 2))

 

Hope this will resolve your issue.

 

Regards,

Hasham

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.