Pick Dates To Align Data Set By

crider816

New Member
Joined
Nov 2, 2015
Messages
6
Hey friends,

Just trying to get some comparison going on for different weeks and I was wondering if there was a way to use DAX to align a series of data based on a given date
Basically I want to Pick a date and then compare a "like" week from a year prior and a month prior. Is there a way to do this in Dax? I think so. I'm pretty decent at DAX formulas so even pointing me in the right direction will be helpful.

-------------------
Here's an Example.
User Prompt (by slicer or something of the like): "Align by:" And they could select First Sunday. 2nd Sunday and

I want the data set to come out looking like.

SaturdayFridayThursdayWednesdayTuesdayMondaySunday

<tbody>
</tbody>
1/9/20161/8/20161/7/20161/6/20161/5/20161/4/20161/3/2016

<tbody>
</tbody>
LINE OF DATA
1/10/20151/9/20151/8/20151/7/20151/6/20151/5/20151/4/2015

<tbody>
</tbody>
LINE OF DATA
12/12/201512/11/201512/10/201512/9/201512/8/201512/7/201512/6/2015

<tbody>
</tbody>
LINE OF DATA
Summary Stats
-------------------

I could do this in VBA obviously but I'd much rather utilize DAX and power query without the hassle of importing directly to an excel sheet.

I have been using a method where I divide the Day # in the year by 7 and a roundup to calculate an "effective week" and then matching on that but with Pivot tables it throws me off when I try to do a month back. Any help is greatly appreciated.
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
I figured it out by utilizing a nTH day of Month function [RoundUp(Date +1 - Date(Year,Month,1)/7,0)]
and I'm just starting the different series by using the VLOOKUP equivalent in DAX LOOKUPVALUE
https://msdn.microsoft.com/en-us/library/gg492170.aspx

Table Set up like
DateDay of WeekMonthYearnTH day of Month
1/1/2008TuesdayJanuary20081

<colgroup><col><col><col><col><col></colgroup><tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,215,641
Messages
6,125,982
Members
449,276
Latest member
surendra75

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top