SAMEPERIODLASTYEAR() but comparing a Wednesday to Wednesday (of the previous year)

Hello DAX experts,
First off, I'm a total newb at this so I appreciate any responses in advance. 
Using DAX, I can't get my head around the logic for comparing Today's date (Wednesday, Feb 11) to the corresponding Wednesday of last year. I can do this with SQL, but is there any quick and easy equivalent within DAX/PowerPivot?
My basic scenario:
Fact Table (RevenueDate, RevenueAmount)
Date Dimension (DateKey, DayOfYear, DayOfWeek, WeekOfYear... All the other good stuff in a Date table)
I've messed around with a few approaches, like pulling a weekly range back and then comparing against a DayOfWeek to find the matching day within that range.  I've also tried loading a PrevYrDate into either the Fact Table or Date Dimension as an additional
column, but I just don't feel like that latter step is best practice.
Could anyone point me in the right direction for comparing Today's date to the same day (not date) as last year?
Thanks!

Have a look here:
http://sqlblog.com/blogs/marco_russo/archive/2015/02/05/customize-period-comparison-in-dax-powerpivot-dax-powerbi.aspx
BR, Imke

Similar Messages

  • Is it okay that my macbook processor make sounds before startup its not mach but i didn't had it in the previous iMac !?

    is it okay that my macbook processor make sounds before startup its not mach but i didn't had it in the previous iMac !?

    are you sure !!? because its normal to hear this sound !!!? I mean i heared in the first day i bought it but its to load !!

  • I bought an iphone5 but cant activate cause it linked to the previous owners icloud

    I bought an Iphone 5 online 2nd hand but cant actavate it cause its linked to what i think is the previous owners icloud but the owner wont return calls to me

    Find My iPhone Activation Lock- Removing a device from a previous owner's account
    iCloud - Find My iPhone Activation Lock in iOS 7

  • SSRS Variance expression problem. Create a Variance expression. Compare current month with same month from previous year.

    Hello,
    I am using VS2010 shell.  I have a matrix report where I have a row group by Year.  Then I have a column group by Month. 
    When I run the report, I get 2013 data on top of 2014 data.  Now I need to create a variance by year for each month.
    So in the example below, I need to create an expression that will pull the variance for Oct 01... subtracting 2013 from 2014 for the months.  So I need to Subtract 8,222 - 4290.  I have no clue.
    Here is what my rdl looks like.
    Thank you for your help. 

    Hi Adrian,
    If I understand correctly, you want to calculate the difference order between 2013 and 2014 for every month. And there are only two years in the FISCAL_YEAR field.
    If in this scenario, we can simply use the following expression to achieve your requirement:
    =first(Fields!ORDER.Value)-last(Fields!ORDER.Value)
    The following screenshot is for your reference:
    If there are any misunderstanding, please elaborate the issue for further investigation.
    Regards,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • I have apples new ipad but my video quality is rubbish and does not seem 1080p but compared to my fujifilm camera the 1080p video is brilliant! Please help..

    i have apples new ipad but my video quality is rubbish and does not seem 1080p but compared to my fujifilm camera the 1080p video is brilliant! Please help..

    Try your iPad with some of these demo clips; go for the 1080p trailer.
    http://www.h264info.com/clips.html

  • I just installed the latest Apple TV software update today. I can still play music from my iPhone 4 to th eATV but purchased movies don't seem to start playing now - or else the buffering time is huge compared with the previous software version.  Any fix

    I installed the latest software update on our Apple TV - this allows us to access VIMEO.  However, although we can still play music from an iPhone 4 we can no longer play purchased tv shows - unless the buffering process has been extended to be glacially slow!  It just shows it is loading but under the previous software release a show would start in a minute or two, nothing is happening afer 4 or 5 minutes with this one.

    Thank you BDAua. This is what I typed and the reply from Terminal
    java -version
    java version "1.6.0_45"
    Java(TM) SE Runtime Environment (build 1.6.0_45-b06-451-11M4406)
    Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01-451, mixed mode)
    BTW - this application does NOT show up in the Applications folder and I consider that a bit odd.
    I also  tried typing Java for my computer to search for and this is what I got under
    Overview:
    PID: 944
    Host: localhost
    Main class: <unknown>
    Arguments: <none>
    JVM: Java HotSpot(TM) 64-Bit Server VM (20.45-b01-451, mixed mode)
    Java: version 1.6.0_45, vendor Apple Inc.
    Java Home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
    JVM Flags: <none>
    Heap dump on OOME: enabled
    I hope something is helpful within all of this info!

  • PLEASE HELP! My iPod is stuck on a black screen but everytime I restore it through iTunes the screen comes back for a short period of time!

    I own an iPod Touch 4g 8gb. Ever since Wednesday August 12th 2012, the screen has had a problem -- it is black. Pitch black. I can tell that it still works -- by sliding my finger down to unlock it I can still hear the lock sounds. My online research told me to reset it and put it in DFU Mode -- but that didn't work. So I connect it to iTunes and restore it to iTunes and after the restoration, the screen comes back -- for a few miniutes. I did this twice and the second time was longer than the first. I have not adjusted any settings that could have anything to do with this.
    So... What to do here? Can someone explain exactly what the problem and it's recovery-processes are?

    I'm not a fan of DFU mode because I've never seen it recommended by Apple.
    First, try a system reset.  It cures many ills and it's quick, easy and harmless...
    Hold down the on/off switch and the Home button simultaneously until you see the Apple logo.  Ignore the "Slide to power off" text if it appears.  You will not lose any apps, data, music, movies, settings, etc.
    If the Reset doesn't work, try a Restore.  Note that it's nowhere near as quick as a Reset.  Connect via cable to the computer that you use for sync.  From iTunes, select the iPad/iPod and then select the Summary tab.  Follow directions for Restore and be sure to say "yes" to the backup.  You will be warned that all data (apps, music, movies, etc.) will be erased but, as the Restore finishes, you will be asked if you wish the contents of the backup to be copied to the iPad/iPod.  Again, say "yes."
    At the end of the basic Restore, you will be asked if you wish to sync the iPad/iPod.  As before, say "yes."  Note that that sync selection will disappear and the Restore will end if you do not respond within a reasonable time.  If that happens, only the apps that are part of the IOS will appear on your device.  Corrective action is simple -  choose manual "Sync" from the bottom right of iTunes.
    If you're unable to do the Restore, go into Recovery Mode per the instructions here.

  • I've reinstalled OS X 10.7.5 using the Apple servers but my files were not erased, has the HD been reformatted and 10.7.5 reinstalled?

    I've reinstalled OS X 10.7.5 using the Apple servers but my files were not erased, has the HD been reformatted and 10.7.5 reinstalled?

    Reinstalling OS X does not erase your files.
    Compare
    OS X Lion: Reinstall Mac OS X
    and
    OS X Lion: Erase and reinstall Mac OS X - Apple Support

  • I have downloaded a concert quite legally and can see it in downloads folder but how do I get to play the concert?

    I have downloaded a concert quite legally and can see it in downloads folder but how do I get to play the concert?
    Thanks
    John

    Double clicking on it should unzip the file, often resulting in a file in a folder or a file alone.  If the file was purchased as FLAC then the file should end in .flac  (if you have display extensions turned on).  FLAC is a common format but it is poorly implemented on Macs, and Apple is obstinate about supporting it, preferring their own Apple Lossless format.  iTunes won't play it and I don't think Quicktime will either.  Many other applications will but it is inconvenient for everyday use.  The easiest thing to do is to use a converter such as Max or XLD (both free) to convert the file to Apple Lossless (if you desire full-quality comparable to the FLAC format), or to AAC (typical of a file purchased from the iTunes Store).  Both can be readily played in iTunes.
    X Lossless Decoder: Lossless audio decoder for Mac OS X - http://tmkk.pv.land.to/xld/index_e.html - Tip for using:  To change most settings you have to go through preferences.
    Max CD ripper - http://sbooth.org/Max/

  • Compare the current value with the previous value in the same column

    Hi all,
    I have to include a statement in a query which allows to compare the current value of column A with the previous value of column A (same column). from there, I need to add a condition in order to have the expected result.
    Let's take an example to illustrate what I want to achieve:
    I have the following columns in table called 'Charges':
    Ship_id batch_nr Order_nr Price
    SID1111 9997 MD5551 50
    SID1111 9998 MD5552 50
    SID1111 9999 MD5553 50
    SID2222 8887 MD6661 80
    SID2222 8887 MD6662 80
    SID2222 8887 MD6662 80
    SID3333 6666 MD7771 90
    I want to check if the ship_id of row 2,3 (and more if available) is equal to the ship_id of row 1.
    If it is the case, then value 'together with the first batch_nr' in row 2 and 3 under Price column. If not, then keep the original value of Price column
    PLease see below the expected result:
    Ship_id batch_nr Order_nr Price
    SID1111 9997 MD5551 50
    SID1111 9998 MD5552 together with 9997
    SID1111 9999 MD5553 together with 9997
    SID2222 8887 MD6661 80
    SID2222 8887 MD6662 together with 8887
    SID2222 8887 MD6663 together with 8887
    SID3333 6666 MD7771 90
    Thanks in advance for your help, it is really urgent.
    Imco20030

    Hi,
    user11961002 wrote:
    Hi,
    Here is the query that I use:
    [ select
    sl.ship_id,
    o.ordnum,
    o.reffld_5 "BatchNR",
    sum(tc1.chrg_amt) "FreightPRC",
    sum(tc2.chrg_amt) "FuelPRC",
    sum (tc1.chrg_amt + tc2.chrg_amt + tc3.chrg_amt) "Total Price"
    from ord_line ol
    join ord o on (ol.ordnum = o.ordnum and ol.client_id = o.client_id)
    join shipment_line sl on (ol.ordnum = sl.ordnum and ol.client_id = sl.client_id and ol.ordlin = sl.ordlin)
    join adrmst a2 on (o.rt_adr_id = a2.adr_id)
    left join tm_chrg tc1 on (tc1.chargetype = 'FREIGHT' and tc1.chrg_role = 'PRICE' and tc1.ship_id = sl.ship_id)
    left join tm_chrg tc2 on (tc2.chargetype = 'FUELSURCHARGE'and tc2.chrg_role = 'PRICE' and tc2.ship_id = sl.ship_id)
    where sl.ship_id = 'SID0132408'
    group by o.client_id, o.ordnum, o.reffld_2, sl.ship_id, a2.adrnam, a2.adrln1, a2.adrpsz, a2.adrcty, a2.ctry_name,
    o.reffld_5, ol.early_shpdte
    order by ship_id
    ]That looks like the query you were using before you started this thread.
    Modify it, using the analytic fucntions FIRST_VALUE and LAG, like I showed you.
    I see that you did simplify the problem quite a bit, and it's good that you did that.
    It doesn't matter that your real problem involves joins or GROUP BY. Analytic functions are calculated on the results after all joins and GROUPS BYs are done. Just substitute your real expressions for the simplified ones.
    For example, in your simplified problem, there was a column called order_nr, but I see now that's it's really called o.ordnum. Where the solution I posted earlier says "ORDER BY order_nr", you should say "ORDER BY o.ordnum".
    Here's a less obvious example: in your simplifed problem, there was a column called price, but I see now that it's really SUM (tc1.chrg_amt + tc2.chrg_amt + tc3.chrg_amt). Where the solution I posted earlier says "TO_CHAR (price)", you should say "TO_CHAR (SUM (tc1.chrg_amt + tc2.chrg_amt + tc3.chrg_amt))". (You can't use an alias, like "Total Price", in the same SELECT clasue where it is defined.)
    I removed some columns from the select as they are not relevant for the wanted action like 'adress details or other references'.
    Now here is the result:
    Shipment ID     Order Number     WMS Batch     Freight      Fuel Price Order Total Price
    SID0132408     MDK-000014-05602649     04641401     110     10 120
    SID0132408     MDK-000014-05602651     04641402     110     10 120
    SID0132408     MDK-000014-05602652     04641363     110     10 120
    as you can see, the 3 orders have the same shipment ID.
    The expected result should be shown under column 'Total Price' as follows:
    Shipment ID     Order Number     WMS Batch     Freight      Fuel Price Order Total Price
    SID0132408     MDK-000014-05602649     04641401     110     10 120
    SID0132408     MDK-000014-05602651     04641402     110     10 tog with 04641401
    SID0132408     MDK-000014-05602652     04641363     110     10 tog with 04641401Okay, so those are the correct results that I asked for, plus the incorrect results you're getting now. Thanks; extra information doesn't hurt.
    But where is the raw data that you're starting with?
    It looks like you tried to format the code (but not the results) by typing this 1 character:
    before the formatted section and this different character
    after the formatted section. To post formatted text on this site, type these 6 characters
    before the formatted section, and the exact same 6 characters again after the formatted section.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Compare month sales with previous year same month sales

    hi all.
    we need to compare given month of this year with same month of last year. we need to compare sales quantity and value.
    the query is on 0RT_C40 multiprovider. We have tried all options using 0Calmon, calday, fiscal year... but whenever we specify offset, we are not getting data. there is valid data for previous year.
    plz let us know what else to do? check with 0RT_C40.
    thanks in advance.
    regards: gaurave

    Gaurave,
    Are you selecting the time period in a selection in columns or rows, or are you selecting the time period in the Filter or Free Characteristic area.
    When you make the initial selection of say Period 11.2007 in the Free Characteristic area, and then within a selection but on an offset to derive 11.2006, the fact that you have made your selection of 11.2007 in the Free Char area will restrict the entire query results to this time period.
    Both your picks on time should be in selections in the Columns or the Rows.
    Regards
    Gill

  • Is the Core i7 processor comparable, much slower, or faster than the 2.8 Ghz core 2 duo from 2009?

    I am looking to get a new MacBook Air, but when looking at the prices I am seeing the MacBook Pro 13" for the same price and a lot more guts (RAM and Processor).  I am ok with spending the amount of money on the air if it means I get a computer that is like my iPad, which i love (flash based, snappy), but don't want it to be super slow.
    I am coming off of a 17" 2.8Ghz MacBook Pro from 2009.  I was happy with the speed and power of that machine.  The most taxing thing I did was make a complilation of family movies in iMovie and burned them with iDVD once in the 2 years of ownership. 
    I mostly browse the internet and compose written documents, and keynote presentations.
    I know my questions may seem stupid, but I don't know how significant the changes between i7 and Core 2 Duo are, so I ask the question:
    I am wondering if the processing power in the core i7 will be somewhat comparable, much slower, or faster than the 2.8 Ghz Core 2 Duo I had in my 2009 computer?
    Thanks for any help!!

    Hi brosephb,
    Like you I went through a similar comparison process. I bought the MacBook air 13" and up specced the processor and memory. I don't do anything taxing enough or frequently enough to NEED the extra power of the MacBook pro.
    I am overjoyed at my air. It's gorgeous, the way it wakes instantly, it's speed and it's portableness is so endearing that I just don't use my iPad anymore. I read numerous reviews on it and the overwhelming opinion was it's addictive ease of use because of it's slim, light and rapid waking. At work I can hold the air with one hand, open it rapidly at will. It's just great but it's made my iPad redundant (for me anyway).
    I see the new airs are even faster and I'm tempted to consider selling my 6 month old air and getting the new one, but, it runs a dream so I am happy to just be envious of the new one.
    In short, unless you need the power (for your work) go for the air. I'm looking at a new iMac to use as a home work station. For the price of a new air I can get an iMac that will swallow any task for a good few years to come. And my air will suffice as my mobile companion. However, that's just me spoiling myself as, at the moment, I have no teal need for another mac. I may get the cinema display for any long winded tasks, as the screen size will help with multiple tasking.
    A bit of a ramble, hope this is useful.

  • Comparing the current value with the previous one in Powershell

    Hi,
    New to scripting and i was wondering how can I compare the current value with the previous value?
    I am having trouble with the loop structure, and I am not sure I am on the right track...
    I am trying to compare the record to next record in the same csv file after import-csv... My code runs fine, but is not giving the right result.
    $FilePath = Get-FileName -initialDirectory "C:\"
    #Testing for null
    If($FilePath)
    $Data = Import-csv -Path $FilePath | Sort-Object BUYER, {[int] $_.PO_NBR}, {[int] $_.LINE_NBR}
    Foreach($fData in $Data)
    $i = $fData
    Foreach($i in $fData)
    if($fData.Buyer -eq $i.Buyer)
    #save all the same buyer name to a new variable
    Write-Host "Same as previous"
    Else
    Write-Host "Variable is null"
    Remove-Item function:\Get-FileName

    Thank you. The Foreach loop is now working properly.
    Can I ask what is the purpose of "-ea 0" in the import-csv? I can't seem to find "-ea" as a parameter for import-csv in help.
    -ea is short for -ErrorAction.
    Don't retire TechNet! -
    (Don't give up yet - 13,225+ strong and growing)

  • ICal has dropped a monthly event for the previous four months....... why did it disappear? and where is it?  It was the same event but a different day each month.

    iCal has dropped a monthly event for the previous four months....... why did it disappear? and where is it?  It was the same event but a different day each month.

      I installed this same digitizer in my T|X some weeks ago.  Some discussion of my experience may be found in this Usenet posting and subsequent thread.
      The stock digitizer in my T|X had always had some significant alignment issues (for which PowerDigi was able to compensate very nicely) and sensitivity which was uneven, but which usually required a heavier touch than I liked.
      Eventually, it began to develop a “dead spot” near the upper left.  My T|X was under warranty, so I probably ought to have sent it in to Palm to be repaired, but I wasn't willing to be without it for the required amount of time, and I've heard enough reports of other T|X owners getting unsatisfactory results this way.  I'd heard enough good reports about the PDAPARTS.COm digitizer, that I decided that the only acceptable way to repair my T|X would be to install one of those.
      After however many weeks it has been, I am still very pleased with the results.  It continues to work flawlessly; it is much more sensitive, so it doesn't require nearly so heavy a touch, and I very much like the hard feel that it has, compared to the spongier feel of the stock digitizer.
      My wife's T|X still has its stock digitizer, and it has so far not shown any of the same problems that mine did, or for which the T|X has become notorious, but the feel is noticeably inferior.  She's content with it the way it is, but I think that if I were to ever buy another T|X for myself, I wouldn't wait for the stock digitizer to fail.  The PDAPARTS.COM digitizer is simply superior in every imaginable way; and, in my opinion, a T|X with the PDAPARTS.COM digitizer installed is sufficiently superior to one with the stock digitizer (even if it isn't defective) to be very much worth the expense and trouble of installing it.
    Post relates to: Palm TX

  • Why does iMessages does not work properly ? Please help me ! Its works better with the previous version if compared with the latest iOS

    Why does iMessages does not work properly ? Please help me ! Its works better with the previous version if compared with the latest iOS

    Many, many thanks for both of you Todd and Rick.
    to Rick:
    I suppose you mean the Color Settings in Project Settings as follows:
    - Working Space: None
    - Match Legacy ... Gamma Adjustments checked ON
    But it does not correct the colors in effects. And checking or unchecking Make Movie/Output Module Settings/Color Management/Profile/Preserve RGB does not make any difference.
    to both of you:
    Those parts of the video image that does not have color effects are just fine. In these parts the color is preserved when reimporting to FCP. However, those parts having color effects (except Levels, as decribed earlier) have altered color results. So, only the parts having effects affecting color are misinterpreted in the image area. The mismatch is of course seen in AE, before making the movie.
    What I ment with "Color Management not working properly" is that (instead of "disabling" it) Color Management does not seem to be able to correct this "misinterpretation" or difference in effect handling between AE 6 and 10.
    So, would you have any solution for this problem?
    Again, many thanks for your fast replies!

Maybe you are looking for