Date as Dateadd – Decoding Date and Calendar 5-5 -…


Problem Description:

Add Days, Month, and Year to a noncontinuous Date column or stand-alone Value. 


Solution Overview :

In Date we can add and subtract dateparts from respective Date Parts
DateasDateAdd_1.png
Solution: In date Add/Subtract Year, Month, and Day.  You can even subtract more than 30 days or more than 12 months

 

Calendar:

 

 

Date = CALENDAR(date(2018,1-12,1),TODAY())

 

 

 

Measures

 

 

Today = TODAY()
Month Back Date = Var _DT = Today() 
return Date(year(_DT),Month(_DT)-1,Day(_DT))

Year, Month, day Back Date = Var _DT = Today() 
return Date(year(_DT)-1,Month(_DT)-10,Day(_DT)-1)

 

 

 

 

 

You can also find a pbix attached to this blog.

My Previous Blogs –

Date Difference Across Table- Direct Query Mode, Decoding Direct Query – Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard Time Periods and Comparing Data Across Date Ranges
Connect on LinkedIn

 



Source link

Be the first to comment

Leave a Reply

Your email address will not be published.


*