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.

Reply
Cyrilbrd
Helper IV
Helper IV

DTD or Day to date measure

Is there a SAMEPERIOD LAST DAY equivalent in DAX?
Hence August 1st to 15th versus July 1st to 15th
Given that today is August 15th.

Given that I have a date DB with dates, day, month, year...


Tried the following but not to avail:

Same Period Last Month = CALCULATE(
[Actual Sales_Pesos],
DATEADD(
Date_DB[Date],-1,MONTH))

I ended up creating a Matrix with the DAY in Rows, MONTH in Columns and sales measure as Values.
I added a slicer for the day and set is as "Between" so I can adjust the period.
Would prefer being able to extract sale values with a formula instead.
Growth rate swould also be computed dynamically.
hence what percentage of growth is August versus July.

This would change monthly, so next month I would have September  vs August.
Any advice?

1 ACCEPTED SOLUTION
VijayP
Super User
Super User

@Cyrilbrd 

Hope you Want this

 

Use these measures

15 Days back revenue =
IF(DAY(SELECTEDVALUE(Dates[Date]))>15,CALCULATE([Total Revenue],DATEADD(Dates[Date],-15,DAY)),BLANK())
 
Comparitive Revenue =
IF(ISBLANK([15 Days back revenue]),BLANK(),[Total Revenue])

2020-08-15_171900.png

Hope this helps! if it helps please mention this as Solution and share your Kudos!!

Thanks

Regards

Vijay Perepa




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


View solution in original post

3 REPLIES 3
VijayP
Super User
Super User

@Cyrilbrd 

Hope you Want this

 

Use these measures

15 Days back revenue =
IF(DAY(SELECTEDVALUE(Dates[Date]))>15,CALCULATE([Total Revenue],DATEADD(Dates[Date],-15,DAY)),BLANK())
 
Comparitive Revenue =
IF(ISBLANK([15 Days back revenue]),BLANK(),[Total Revenue])

2020-08-15_171900.png

Hope this helps! if it helps please mention this as Solution and share your Kudos!!

Thanks

Regards

Vijay Perepa




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


TomMartens
Super User
Super User

Hey @Cyrilbrd ,

 

I have to admit that I do not fully understand what you are looking for. For this reason, I recommend start reading this article: https://www.daxpatterns.com/time-patterns/#

 

From my experience, alomost everything time/date related calculations are covered. Also how to consider a leapyear and what to do if today is the 31 of Marth 2020.

 

Hopefully this provides some ideas on how to tackle your challenge.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

I edited my question, I am looking for Day to Date. I can do MTD or YTD but am looking for DTD.

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors