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
svishwanathan
Helper III
Helper III

Powerpivot/dax help

Hi 

I have a spreadsheet that contains  open ticket information. We have added a column called Reporting Date which captures when the report was downloaded to help us with doing some snapshot trending. Usually it is done once a week but sometimes the interval can be 10 days or more.

 

I want to be able to index or give a number to these reporting dates

 

For instance, the last reporting date was 1/21. so that row should contain 0 and the previous reporting period was 1/14...so those rows to contain -1

 

Report date            Relative Index

1/21/2018                   0

1/21/2018                   0

1/14/2018                    -1

1/21/2018                    0

1/7/2018                       -2

1 ACCEPTED SOLUTION
v-yuezhe-msft
Employee
Employee

@svishwanathan,

A bit change to Phil_Seamark's DAX formula.

Column = 
VAR x = MAX(Table[Report Date]) - (WEEKDAY(MAX(Table[Report Date]),1)-1)
RETURN-DATEDIFF(Table[Report Date],x,WEEK)

1.JPG

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yuezhe-msft
Employee
Employee

@svishwanathan,

A bit change to Phil_Seamark's DAX formula.

Column = 
VAR x = MAX(Table[Report Date]) - (WEEKDAY(MAX(Table[Report Date]),1)-1)
RETURN-DATEDIFF(Table[Report Date],x,WEEK)

1.JPG

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Phil_Seamark
Employee
Employee

Column = 
VAR x = TODAY() - (WEEKDAY(TODAY(),1)-1)
RETURN-DATEDIFF('Table2'[Report Date],x,WEEK)

This calculated column may be what you are after


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Phil_Seamark
Employee
Employee

HI @svishwanathan

 

Are the dates always Sunday?


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

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.