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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

amitchandak

Date as Dateadd - Decoding Date and Calendar 5-5 - Power BI Turning 5 Celebration Series

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 -

Week Is Not So Weak,

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

 

Comments