Dax Calculating Same time previous period with nonstandard periods

I need help dealing with prior period calculations where the periods are not standard.
In our business we define these time periods based on 8 to 10 week periods that really have no correlation to standard weeks, months or quarters.  Additionally there may be some time between these periods that are not defined. For example:
Period 1 (p1) = June 18 - Sept 2
Period 2 (p2) = Sept 17 - Dec 9
The length of the periods are variable and when one ends another does not necessarily begin.
I need to figure out how to compare the sum of a metric in Period 2 with the sum of a metric in Period 1.
I have a standard Date dimension. And I have a period deminsion with the period labels (p1, p2 etc.) the start date, the end date of the periods, and a column called previousPeriod that has the label of the prior period.
Each Fact has a Period ID so that I can use period as a dimension.One of my measures is Sum(sales).
I want it so that if I am viewing the Tabular cube by period, I can have the sum of sales for that period, and the prior one. I hope it is clear what I am trying to do.

You should add to your Date table a column that contains an incremental number for each period, then write something like:
        CALCULATE
            [Sales],
            ALL
( 'Date' ),
            FILTER
                ALL
( 'Date'[IncrementalPeriod] ),
                'Date'[IncrementalPeriod]
                    =
EARLIER ( 'Date'[IncrementalPeriod]
) - 1
I suggest you this pattern that will be published on March 31 - it contains many more examples, including how to write the make this formula working also with a partial arbitrary selection of days in the selected period:
http://www.daxpatterns.com/time-patterns
Marco Russo http://www.sqlbi.com http://www.powerpivotworkshop.com http://sqlblog.com/blogs/marco_russo

Similar Messages

  • Does anyone knows a way to work with various Pages documents at the same time, for example with a system of tabs to switch directly from one document to the other?

    Hello everyone,
    Working with numerous Apple Pages documents at the same time, I am looking for an efficient solution to switch faster from one document to the other. Integrating all them in a single framework, for exemple by switching from one to the other with a system of tabs would be of great help. Does anyone knows if such a possibility exists?
    Thanks in advance,
    Jean-Baptiste

    jbp- wrote:
    Thanks. It works and is very efficient. Not as much as a real system of tabs, but is allows to switch very fast between different documents. Only regret I would have is that it doesn't work with a document which is on full page mode. But that's already very helpful!
    You're very welcome but Peggy really gave you the answer already. 
    With regard to the full screen apps, I don't think Apple have yet worked out how to make them elegantly coexist with other apps.  The closest you can get is the four finger swipe gestures you may use on a trackpad if you have one (Mission Control and App Exposé).
    In fact nowadays I use the App Exposé (four finger swipe down gesture) more often than I use Command-Accent to move between documents in the same app (when not in full screen).  It also as the advantage of showing you thumbnails of recently opened documents below the ones already open within the app.  If you haven't tried it, I suggest you give it a whirl.
    I can't remember now but I think the four finger gestures are not enabled by default and you must switch them on in System Preferences > Trackpad > More Gestures. 

  • Can I have 2 Bluetooth connection active at the same time? Works with other phones...

    Is it possible to have one Bluetooth connection for "phone audio" and a 2nd connection for "A2DP" music streaming at the same time on my iPhone 5? My car-stereo has Bluetooth for phone calls but NOT for audio streaming. However, there's a 3.5mm aux in on the head unit. On my S5 I can create one Bluetooth connection to the car-stereo and select "phone audio" and a 2nd for my Bluetooth aux-in adapter. It works perfect since months but last week I changed back to an iPhone (5s) and it appears that I can only have ONE BT connection active at a time!?  Any ideas anyone?

    Hi SwedelostinAmerica,
    Welcome to the Apple Support Communities!
    The iPhone can maintain multiple pairing records, but it can only connect to one headset or hands-free device at a time. However, in your situation there may be a solution. You can connect the iPhone via Bluetooth for calls and use the 3.5mm jack on your iPhone and car radio to connect for music.
    The following article explains Bluetooth pairing and usage. Please use it as a reference.
    iOS: Third-party Bluetooth accessories
    http://support.apple.com/kb/HT1664
    Have a great day,
    Joe

  • How do I get my font to automatically capitalize on the next sentence after ending the previous sentence with a period?

    For Pages software, how can I have the first letter after a sentence ending period automatically capitalize?  Can't seem to figure it out...thanks!

    While we all have MacBooks in this forum not all of us use Pages. There's a Pages Support Community where everybody uses Pages. You should also post this question there to increase your chances of getting an answer.
    https://discussions.apple.com/community/iwork/pages

  • Two Firefox at the same time, (one with images, other without)?

    Hi,
    Is is possible to use two firefox browsers at the same time, the one with images enabled, the other disabled?

    See this easy to follow directions:
    http://www.callum-macdonald.com/about/faq/multiple-firefox-instances/

  • Insert multiple records at the same time to table

    hi,
    My page has,
    1. MessageStyledBean showing a foreign key(say FID) that is passed from previous page.
    2. Advanced table, showing 2 poplist in each of its column, named poplist1 and poplist2.
    3. I have a primary key which should be populated in sequence, i am not displaying it anywhere inthe page(is this right and fine).
    4. I have 'Add another row' button in my advanced table.
    5. I have apply submit button at the bottom of my page.
    So for the same FID at the same time, a user can add multiple rows of poplist1 and poplist2 values using Add another row. Once the user clicks Apply, say after he assigns 2 rows to the same FID in the same page at same time, 2 rows with same FID, different primary ID(in seq), with selected poplist values should be added in the database table.
    I have no clue of how to do this. Pls sombody help me out in doing this.
    Thanking you
    ri

    1. In EOImpl, you can override create(AttributeList nameValuePair) method and set the primary key and FID value.
    This will be called for each row creation.
    you can do
    getOADBTransaction() .getSequenceValue(String pSequenceName)
    to get teh sequence in EO.
    Hope it helps.
    Cheerz,
    Rathna

  • My SB Audigy 2 card can't use headset and musicamplifier at the same time

    Hi, i just bought a SB Audigy 2 [D400] and i have downloaded drivers and programs. I run Windows XP SP2.
    The soundcard works fine but it is very very annoying that i physically have to change the jack in the green=line out jack from headset to musicamplifier when i want to use my musicamplifier and change back the jack in the green=line out from musicamplifier to headset when i just want to use the headset/headphones .
    In the shop they told my that i can connect both amplifier and headset at the same time and then with creative software control whether there is sound in the headset or in the amplifier. But i can't simple get it work.
    I tried to use the green to the amplifier and the headset/speakers in the black (line out 2) and then with creative speaker settings softeware choose headphones but still the ampliefier receive the sound and no sound in the headphones. Why? In fact no matter what configuration i try the headphones doesn't work.
    But if i change the jacks so headset is in the green line out then only headset is working and the amplifier doesn't work no matter i put it in sort=line out 2 jack or orange=line out 3 jack.
    Can somebody here tell me if it is possible or not to connect both headset and external amplifier and control by software which to play? and how?
    please help, thx.
    Michael

    If you can have an ASIO compatible music playing system, then it might be possible to have system like you wish when using Creative Audigy 2 card. Since ASIO bypasses Windows Audio System, you can use both 'drivers' (ASIO - WDM/MME/DS) side by side.
    Say you want to play a game (using headset /w mic) and someone other like to listen music at the same time. With ASIO capable system you can output your music for example to "center L/R (stereo) channels" and same time output sounds from other source (using MME/DS/WDM drivers) to normal output channel (Front L/R). Only thing is, you need to set your speakersystem to 4 or 6 (depending which other channel you're using) (and for better 'balance' to adjust "angle" on THX console. You get the THX console by installing Audigy 2 Zs software).
    Try for example http://img332.imageshack.us/img332/463/djs9mo.jpg[/img] width="406" alt="Image Hosted by ImageShack.us" >
    Another option:
    Say you want to play music through external amplifier and play game online with your headset + microphone (eg. others but you listen the music, you play games)
    --> try free http://img332.imageshack.us/img332/4589/tbp7rz.jpg[/img] width="406" alt="Image Hosted by ImageShack.us" >
    If you use ASIO on BeatPort Player you can select L/R individually from the list(s). Same rules as described earlier.
    = You can play from 2 different sources simultaoneusly (ASIO + WDM/MME/DS) to two different outputs without disturbance. The other (WDM/MME/DS) source is set 'automatically' output to (Audigy) "green" port, and the other (ASIO) to "black" or "orange" port (as set).
    .jtpMessage Edited by jutapa on 09-5-2005 05:30 AM

  • Can't get 2 firewires to mount at the same time

    i just bought 2 500 gb externals to set up a raid, and i can get either one to show individually, but not at the same time- either by daisy chaining or using separate ports. the second will even show up if the first is off when they are daisied. i don't know for sure that i've ever used 2 at once, but am fairly certain i have. the ports all work individually- both 400's and the 800. i tried 1 800 and 1 400 at the same time, and daisied with 800 main + 400 daisy and 800 main + 800 daisy, all to no avail. nothing wrong with the cables- i cross checked. it's flakey mounting and dismounting, too (for instance, stuff disappears once dismounted and won't reappear til i reboot, even if i restart the device).
    i reformatted both drives to mac journalled. i searched and have followed the instructs to reset the firewire ports, repaired permissions (many times) zapped the pram, and shut down the comp for 15 mins, inc the power, without any other devices attached to troubleshoot each drive, all to no avail. one strange thing- even the 400 ports showed as 800's in the profiler. only one at a time will show there, as well- whatever is mounted (or the first i mount; the second doesn't show). i should note i had a drive go bad on the 800 port not once but twice in the past year, and assumed it was the drive (it was used), but now i'm wondering if the port's funky. do they go bad and how hard are they to replace?
    i don't really want to have to reload my system- i have an awful lot of software loaded and am in the middle of a busy time, plus i suck at that. i'm getting ready to add a couple gigs of ram to speed things up, too. it should be here tomorrow. i'm a retoucher and work on big files that need backed up regularly, which is why i'd like to do the raid and just work off it. i'm not on tiger- have been waiting for leopard, and was so mad when they pushed it back, since it means i have to wait on cs3, too, which really hurts my business. but i'll be darned if i upgrade now and then have to pay again in 3 months. i wish they'd offer the upgrades at half price this close (or do like other co's do and upgrade for free within a reasonable amount of time- not 7 days). any advice i haven't tried? please?
    G5   Mac OS X (10.3.9)   dual 1.7 mh; 1GB ram; 2, 250's hard drive

    ok- i will try to answer what i can, but bear with me- i'm really good at what i do, but this ain't it. some of what you asked i don't know where to find the answers to. to start, the drives are western digital my book pros, 500 gb each. they support firewire 400, 800 & usb. the old drive that failed twice was a lacie 500 gb, too (with the metal case- don't know the official name off the top). i have pro friends who have similar setups with no issues (and am seeking advice from them as well).
    i have a 1.8 mh dual, but i do have 8 ram slots, and i wouldn't want to deal with a mac book pro. retouching just doesn't work well with laptops, and i don't travel so i'd have no need. when i'm ready to get a new system, i want an intel quad. hoping i can push that off a year or 2, with the ram additions and raid.
    i'm not using pci fw800 card adapter. my friend says he thinks a hardware raid solution like the la cies that run off a SATA card would work better, but he was curious if i can do what i want with the PCI-X card and the drives i have (since i don't want to return them or spend huge amounts more of moolah). so, do you know if i did get one if it would make the raid work? or would a 400 card be better? i'm not a photog filling a tb with each job (which my other refs are) so i don't need the huge volume of space that they do. but i do work on some pretty big files at times, and it can add up quickly. i think a terabyte raid would hold me for quite a while- which is why i did the 2 500's.
    when i unplugged the machine and left it down for 15 mins, i unplugged everything, inc power cord, except the mouse and monitor cable, per instructions i found through the apple site.
    normally i don't care to be on the bleeding edge and wait a little while to get new software, but it seems like i've waited so long, and leopard has so many features i think would be great. my buds agrees with you that getting the stable os is the best bet, and that i'm being too cheap. i guess that's the next step then, huh?
    here's what the profiler says in general: Machine Model: Power Mac G5
    CPU Type: PowerPC 970 (2.2)
    Number Of CPUs: 2
    CPU Speed: 1.8 GHz
    L2 Cache (per CPU): 512 KB
    Memory: 1 GB
    Bus Speed: 900 MHz
    Boot ROM Version: 5.1.4f0
    Serial Number: ********
    and specifically about the firewire:
    FireWire Bus:
    Speed: 800 Mb/sec Speed
    External HDD Device:
    Capacity: 465.76 GB
    Manufacturer: WD
    Model: External HDD Device
    Removable Media: No
    Detachable Drive: Yes
    BSD Name: disk2
    OS9 Drivers: No
    Speed: 800 Mb/sec Speed
    Unit Spec Id: 12512
    Firmware Revision: 107a
    Unit Software Version: 484944
    let me know if i answered what you wanted, and if there are more ?'s. i haven't had a chance to try both 400's at once yet since i'm mid-job that i can't close right now.
    thanks so much for your advice.

  • I dont get sound for videos, games and music but ringtone still works. When i press volume buttons on side of phone i only get the picture of the nell and no little dots underneath. This is on my iphone 4s and ipad. It happened at the same time.

    I dont get sound for videos, games and music but ringtone still works. When i press volume buttons on side of phone i only get the picture of the nell and no little dots underneath. This is on my iphone 4s and ipad. It happened at the same time.

    Recurring theme with the 4s losing alerts except for the phone ringing.  Most complaints seem to center on the 7.1 upgrade.  The fix is dodgy, putting in a charger, playing a you tube video then pulling out the charger and wiggling it until you get the sound back.  When you get the sound back, the volume buttons start to work again.  Alternate solutions involve cleaning the docking port with a toothbrush, running a pick over the electrodes etc.

  • Enable Usage Rights to Multiple Documents at the same time

    I was wondering if there is a way to add Enable Usage Rights to Multiple Documents at the Same Time?

    Not with Acrobat. Adobe's LiveCycle Reader Extensions application is
    used for high volumes.
    Aandi Inston

  • CSM route mode and bridge mode can exist at the same time?

    I'm using CSM on ver 4.x,and I used to the bridge mode for firewall load balance,for a new requset,I have to create a new server/client vlan,but the original firewall load balance was effected when I issued the server vlan command,and I'd like to use route mode for the new server farm,I'm wondering that route mode and brige mode can't exist at the same time,because it seems it doesn't make sense.Any reply will be very appreciated.

    you can use bridge mode and route mode at the same time.
    Traffic with desintation mac address being the CSM will be routed, otherwise it will be bridged.
    Gilles.

  • Running 2 apps at the same time

    My wife has an ipad2 that she loves, but she just updated the  ios to 6.1.3 from 6.0, thanks to me, and now she is really upset.  She "use" to be able to listen to audio from Youtube on Safari, bad youtube apps, and also be able to play games at the same time. Now with this upgrade, she can't do this, the audio just shuts off when she starts the game.  She aleady knows the process of starting the youtube video then doubl clicking the home button to bring up th menu at the bottom of the page and then starting her game, but the new iOS just shuts off what she was listening to.  Is there a fix for this or an easy work around??  We don't want to jailbreak either, because we shouldn't have to.
    do the newer ipads handle multiple apps running at the same time better with the faster chips??

    Hi Tim,
    I'm a little confused by this, if you listen to music from the Music app on the iPad this should still keep playing when doing other stuff but anything playing in Safari that I've had playing has always turned off when switching between apps.
    Regards,
    Steve

  • With previous editions of iTunes for Windows, I could play a CD at the same time as it was being imported. That does not work anymore. Why not, and is there a way to do both with the most current version?

    With previous editions of iTunes for Windows, I could play a CD at the same time as it was being imported. That does not seem to work anymore. Why not, and is there a way to do both with the most current version? I am running a Surface Pro 2 with Windows 8.1 and the most recent vesion of iTunes, which, in all other respects, works well. I just can't listen to an album for the 1/2 to 1 hour that it takes to import it into my library.

    Two JVM's ? I thought that J2EE worked within a single JVM and run everything in containers. Can you see the two processes?

  • How can I use the built-in Isight camera with an external camera (usb/firewire) at the same time?

    How can I use the built-in Isight camera and an external video camera at the same time?
    I'm wanting to stream over Oovoo/Skype/etc. using 2 cameras.
    Thanks

    Simple question with a not so simple answer.
    (a) If you mean that you want to run multiple apps simultaneously using a different camera with each app, you may encounter computing power limitations.  Digital video is processor intensive.  The only way to know if your Mac can do this it to try it.  If the video does not work together but each app works when it it the only app running, you are likely overloading your Mac's ability to process and/or move all the required data in your data bus.  You can get a better indication of whether this is the case by watching your Activity Monitor utility while running the apps you want to use.
    (b) If you mean that you want to have more than one compatible camera connected to your Mac simultaneously for ease of changing between video sources, some, but not necessarily all, apps you are using to operate your camera(s) allow you to select between your cameras.
    How you select among connected cameras depends on which application you are using. Here is how camera selection works in a few examples:
    (1) For iChat, you can choose which iSight you use in the "Camera:" choices bar in iChat > Preferences... > Audio/Video that appears when more than one compatible camera is connected. Although your camera choices will be different, the choices bar will look something similar to the Preferences settings shown here:
    If you cannot see the "Camera" choices bar, your Mac is recognizing only one (or none) of your cameras. In that case, consider the suggestions fromhttp://support.apple.com/kb/HT2090 for iSight problems or refer to your other camera's documentation for help.
    This particular choices bar solution applies ONLY to iChat. Most other applications also have settings that allow you to choose which camera to use. However, they do not all work the same way.
    (2) For instance, iMovie HD's camera choice is NOT set via Preferences. When you have more than one compatible camera connected, iMovie6 HD uses a drop-down menu choice something like this (depending on which version of iMovie you use):
    Note: Because I had no built-in iSight connected when I made this example, and because my external iSight was not connected, the drop-down menu showed only "Time Lapse." Because your Mac has a built-in iSight, your built-in iSight would show in the drop-down menu even when no other camera is connected. Connecting an additional Mac compatible webcam should allow you to choose either camera.
    Other iMovie versions work slightly differently.
    iMovie 9 (from iLife '11) uses a different camera choice button shown in this article:
      http://docs.info.apple.com/article.html?path=iMovie/9.0/en/mov39f84285.html
    iMovie 8 (from iLife '09) is slightly different as explained in this article:
      http://docs.info.apple.com/article.html?path=iMovie/8.0/en/10172.html
    In general, you can use your Mac's help for the application in use to find out how to select among more than one connected camera.
    (3) Photo Booth in Snow Leopard 10.6.x and later uses the Photo Booth > Camera menu command to select which camera to use.
    Note for readers with older Mac OS X: The previous version of Photo Booth that came with Tiger (10.4.x) is such a simple, basic app that it offers no menu selectable choice. Unless your built-in iSight is already occupied as the camera being used by some open application before you launch Photo Booth, Photo Booth will use ONLY your built-in iSight.
    However, you can use the trick from ¶ 4 of http://docs.info.apple.com/article.html?artnum=302781 to let Photo Booth use an external camera.
    (If you have an external Firewire camera connected, it may be used in preference to any USB webcam. If that is a problem for you, merely disconnect the problem Firewire device.)
    (4) For FaceTime, launch the app and click the Video menu item.
    If your Mac recognizes more than one connected compatible camera, a "Camera" section listing the cameras from which you can choose will appear there. Clicking on the desired camera name will let you select the one you want as shown in this image from my Mac Pro and LED Cinema Display:
    If your Mac recognizes only one compatible camera, the "Camera" section will not appear in the Video menu, but FaceTime will automatically use the connected camera that is recognized by OS X.
    (5) I do not use Skype oir Oovoo.  For those or other apps, see Help for each app for info on how to select your desired camera.
    Message was edited by: EZ Jim

  • IPhone - how to sync with iPhoto and Aperture at the same time ???

    I'm having a really hard time with syncing my photos - I'm using iPhoto and Aperture on my Mac. When I launch iTunes and start managing my iPhone, it seems like I should be able to sync photos from a variety of sources all at once (iPhoto, Aperture, other folders).
    However, whichever option I select in the photos drop-down becomes the only libraries that are available to sync. What I mean is that if I select some of the Albums in my iPhoto list and sync those, when I later drill down to Aperture and select albums from there and perform a sync - then the previously synced/loaded albums and photos from iPhoto are automatically removed from the iPhone.
    Why can't I sync between multiple photo albums / sources at the same time? This is incredibly annoying.

    Here's how I solved this problem:
    In Aperture, select File -> Import -> iPhoto Library
    Then under the "Store Files" dropdown, be sure "In their Original Location" is select. This will allow Aperture to see your iPhoto library, but it will be managed by reference rather than phyisically imported.
    Now, in iTunes, select Aperture as the application from which you want to synch photos, and select the option to synch specific albums.
    You should be able to see the names of albums in iPhoto as well as those created in Aperture.

Maybe you are looking for