MDX Query to show the latest product text again historical facts (Type 2 dimenion linking on Surrogate key and also Natural Key)

I need to write a MDX query to show the latest product text again historical facts or a chosen product text in time. I can write this query in TSQL, but new to MDX.
The way I do it in TSQL is joining two queries together on the Natural Key as opposed to the surrogate key.
Can this be done in MDX. I know I could write two separate MDX queries, one which get the product text I wan and the other to get the measure with the actual product text and Natural Key, and use a lookup function in ssrs to show the two result sets I the
same tablix by looking up the Natural Keys. But this should be able to be done in one query shouldn't it.
In the dsv the fact knows to join to the dimension using the surrogate key.
Thanks J

Hi Jamster,
According to your description, you want to write a query to show the latest product text, right?
In MDX, we can use LastNonEmpty function to return the lastest member winth a dimension. LastNonEmpty is an aggregation function available in the Enterprise version of SQL Server. However, you can create your own with a little bit of recursive MDX. Here
is a sample query for you reference.
With Member Measures.LastHits as
iif(isempty(Measures.Hits),
([Date].[Year Month Day].prevmember,
Measures.LastHits
),Measures.Hits)
Reference
http://cwebbbi.wordpress.com/2011/03/24/last-ever-non-empty-a-new-fast-mdx-approach/
http://richardlees.blogspot.com/2010/07/getting-last-non-empty-value.html
If this is not what you want, please provide us the detail structure of your cube and the expected result, so that we can make further analysis and give you the exactly MDX query.
Regards,
Charlie Liao
TechNet Community Support

Similar Messages

  • Query to identify the Latest Pur Price of a item's First PO doc Num & Date

    Hi Experts,
    Version: 2007B
    I want a query to do FMS in my purchase order UDF.
    The information i need in UDF through FMS is,
    I want the document number and Posting date of the first document of the Last purchase Price. Let me make it more clear with the example.
    I am creating a Purchase order of PO01 for a item XXXX1  on 12/3/11, and enter the price of INR 400.
    and again creating the Purchase order of PO25 for the same item as on 25/04/11, here since the last purchase is the price list am selected in the document level , it will show me as 400. its right.  now here i want the information in my UDF is   " Ref:PO01 as on 12/03/11"
    This information am using it to identify the LATEST PURCHASE PRICE'S FIRST DOCUMENT DATE AND ITS DOC NUMBER to give a proof to the supplier.
    Hope this information would explain my requirement.
    Regards,
    Dwarak
    Edited by: Dwarakanath.P on Apr 19, 2011 3:11 PM

    Dear GordonDu,
    While executing this query, am getting these errors.
    1). [Microsoft][SQL Native Client][SQL Server]Unclosed quotation mark after the character string ' as of +T0.DocDate  From OPOR T0 INNER JOIN POR1 T1 ON T1.DocEntry=T0.DocEntry  WHERE T1.ItemCode = $[$38.1.0]  ORDER BY T0.DocDate DESC FOR BROWSE '. 2). [
    2). [Microsoft][SQL Native Client][SQL Server]Incorrect syntax near '$38.1.0'. 2). [Microsoft][SQL Native Client][SQL Server]Statement 'Service Contracts' (OCTR) (s) could not be prepared.
    Please Let me make sure of my requirement once again in short.
    1)  I have created a UDF in a Purchase Oder at title level.
    2) next, i am creating a PO for 3 items.
    3)now, i want to display the 3 items doc no and Posting date of the first Puchase order of the latest price(Last price).
    thanks for your time, if you dont mind , and if you need i can also come in skype voice chat to clarrify my requirement friend.
    thanks & regards,
    Dwarak

  • I used to be able to sync my iphone with itunes, but now when I plug my iphone into my computer it no longer syncs or even shows the device icon.  Could this be because I have an old iphone and it's not compatible with the latest version of itunes?

    I used to be able to sync my iphone with itunes, but now when I plug my iphone into my computer it no longer syncs or even shows the device icon.  Could this be because I have an old iphone and it's not compatible with the latest version of itunes?

    Refer to this article under section 4: Verify that the Apple Mobile Device USB Driver is installed
    iOS: Device not recognized in iTunes for Windows
    http://support.apple.com/kb/TS1538

  • Creation of a Query to show the values for the current month and the last 12 months data.

    Dear All,
    Good day!
    I have to create a Query with the below requirement.
    I have to create a Query to show the values for the current month and the last 12 months data.
    Can you please guide me how to achieve this ??
    thank you,
    Regards,
    Hema

    Hema
    explain the exact problem..? as you mentioned you want to create query to show values for current month and last 12 months.. so I think you want to show values for 12 months from current data.. you can achive this by multiple way..
    you can have selection screen and field with date .. and restrict based on system current date and 12 months before or you can handle this at your target.. .. I mean there are multiple ways to restrict data by date range..
    for some more hints..
    http://www.forumtopics.com/busobj/viewtopic.php?t=34393&sid=7fba465d0463bf7ff5ec46c128754ed6
    http://businessintelligence.ittoolbox.com/groups/technical-functional/cognos8-l/how-to-display-last-12-months-in-report-based-on-todays-date-3231850
    http://scn.sap.com/thread/3217381
    search on SDN you will get many other ways..
    Thanks,
    Bhupesh

  • FF doesn't show the latest version of a website, Explorer does. Where can I change this option?

    Please check www.megasound.dk in FF and then in Explorer. The Explorer version is the recent and correct version. The FF version is an old version. Is there an option in FF, "show the latest version of a website"?
    How to solve this problem?
    Br
    Salinanu

    Reload web page(s) and bypass the cache.
    *Press and hold Shift and left-click the Reload button.
    *Press "Ctrl + F5" or press "Ctrl + Shift + R" (Windows,Linux)
    *Press "Cmd + Shift + R" (MAC)
    See also:
    *http://kb.mozillazine.org/browser.cache.check_doc_frequency

  • I've just set up my mac Mail to receive my hotmail. It's now trying to download the whole of my hotmail account of 20,000 emails! I only want it to show the latest 200 (like on iPhone and IPad) Is there anyway to control this?

    I've just set up my mac Mail to receive my hotmail. It's now trying to download the whole of my hotmail account of 20,000 emails! I only want it to show the latest 200 (like on iPhone and IPad) Is there anyway to control this?

    On your iPad, just go to Settings>Mail, Contacts, etc.>Add account>iCloud and put in the details of the account you set up.  Shouldn't be a problem at all.

  • Conversation doesnt show the latest message but an old one.

    Each time i click on a conversation in Mail, it doesnt show the latest message, but on old one. Changing the settings to 'place latest message on top' (sorry don't know exactly how they have translated this, I am running Dutch version) does not fix this.
    If you change the settings to 'place latest message on top'. It does place the latest message on top, but it shows an old one. So each time i click on a conversation, i have to scroll to the top to see the latest message. This is very irritating. I already answered several old messages. People think i am getting ********...
    I am using Mail in classic view! Changing it to the new view, doesnt fix it either.

    Hey Olivia,
    If you are having an issue with your iPhone only showing the most recent message of a conversation in the Messages application, and you have already tried restarting and resetting the iPhone, the next thing to try would be to back up any data on the iPhone, erase it and set it up as a new device. See this article for directions -
    How to erase your iOS device and then set it up as a new device or restore it from backups
    Thanks for using Apple Support Communities.
    Happy computing,
    Brett L 

  • Need Store DB tables to query to get the latest scanned price at register

    Need Store DB tables to query to get the latest scanned price at register.
    Please provide a sample sql script that will help me do this. I need to have this informatino for several items at a time.
    Thanks,
    Edited by: user10133807 on Jan 13, 2012 9:22 AM
    Edited by: user10133807 on Jan 13, 2012 9:23 AM

    Hi,
    You can find multiple items saled price at the register by running below quary
    select distinct DC_DY_BSN,ID_ITM_POS,MO_PRN_PRC from TR_LTM_SLS_RTN;
    Thanks,
    MG

  • My homepage does not show the latest page when I open Firefox

    I have set MSN as my homepage but when I open Firefox it does not show the latest MSN page.

    '''''Has the site worked normally in Firefox before?'''''
    When you have a new problem with one particular site, a good "first thing to try" is clearing your Firefox cache and deleting your saved cookies for the site.
    (1) Bypass Firefox's Cache
    Use Ctrl+Shift+r to reload the page fresh from the server.
    Alternately, you also can clear Firefox's cache completely using:
    orange Firefox button (or Tools menu) > Options > Advanced
    On the Network mini-tab > Cached Web Content : "Clear Now"
    If you have a large hard drive, this might take a few minutes.
    (2) Remove the site's cookies (save any pending work first). While viewing a page on the site:
    * right-click and choose View Page Info > Security > "View Cookies"
    * Alt+t (open the classic Tools menu) > Page Info > Security > "View Cookies"
    This will open a window listing the site's cookies, which you can remove individually.
    Then try reloading the page and logging back in. Does that help?

  • How do I Determine the latest product-specific patches for EBS 10.1.1 updgr

    I am in the process upgrading EBS 11i to 12.1.1 and currently at step 3:12 of page 3-6 (Apply latest product patches (required)) of doc Part No. E16342-03.
    How do I determine the latest product-specific patches - EBS in particular?
    Can someone give me the link for the "download the American English patches."
    Thanks and God blesss.
    Mathias

    Hi,
    1) Is there a script that I can execute to find out exactly which are the installed products on our system so as to select the right products from the 'Product or Product Family'?How to Establish if a Product is Installed in e-Business Suite 11i [ID 420648.1]
    2) I have installed 12.1.1 and I believe I have to upgrade to 12.1.3 but with the dozens of documentations around the upgrade it is just so difficult to pinpoint exactly which way to move forward with. For example I have lead to
    Oracle E-Business Suite Release 12.1.3 Readme [ID 1080973.1] and I am wondering if I should follow the guidlines in this document?You will need to follow all the documents listed in
    Database Preparation Guidelines for an E-Business Suite Release 12.1.1 Upgrade [ID 761570.1]
    Interoperability Notes EBS R12 with Database 11gR2 [ID 1058763.1]
    Database Initialization Parameters for Oracle Applications Release 12 [ID 396009.1]
    Upgrading OracleAS 10g Forms and Reports in Oracle E-Business Suite Release 12 [ID 437878.1]
    Oracle E-Business Suite Release 12.1.3 Readme [ID 1080973.1]
    R12.1: Oracle Financials Pre-Upgrade Patch - Supplemental List for EBS CUP [ID 1127593.1]
    EBS: R12.1 Oracle Financials Recommended Patches [ID 954704.1]
    Thanks

  • Why would Firefox not show the latest version of a web site?

    At www.brunswickharley.com, Firefox 3.6.3 (on Windows XP SP3) kept showing an obsolete version of the site. IE showed the latest version. I haven't encountered this before. Is it the web site or Firefox?
    I can't review the site's code because I copied the URL of the page I wanted from IE to Firefox, so now Firefox shows the right page.

    I contacted company, Brunswick Harley, and was told that they knew about the problem. Then I contacted the web site developer, who said Brunswick Harley inserted material in the web site that couldn't be viewed in Firefox.
    Both of them said they were working on the problem. Neither said exactly what it was, but it must have been a feature that only IE supports. So I guess Firefox is off the hook.

  • How do I retrieve a older backup on itunes that I saved last week in the PC. Currently, it shows the latest backup was yesterday, but I need the backup I saved on 18.10.13. Can anyone help?

    How do I retrieve a older backup on itunes that I saved last week in the PC. Currently, it shows the latest backup was yesterday, but I need the backup I saved on 18.10.13. Can anyone help?

    It keeps only the last backup.

  • HT204150 I have recently switched to the latest i-phone. my contacts are updated by i-cloud between phone and mac laptop.there are only about 720 contats showing on phone from app. 1250 on the computer. please advise how to correct phone

    I have recently switched to the latest i-phone. my contacts are updated by i-cloud between phone and mac laptop.there are only about 720 contats showing on phone from app. 1250 on the computer. please advise how to correct phone

    On the mac, only contacts in the "iCloud" section will sync to other devices.  Those in the "On my mac" section do not.  Could that be your problem?
    To test the icloud situation, log into icloud.com with your mac's safari and to to the contacts page.  What you see there is what icloud has received from mac and iphone. 

  • Nokia weather not working and show "The latest for...

    Hello every one,
    I'm in Egypt and I haven't been able to load a weather forecast for in Nokia Weather, it show "The latest forecast is not available." why?

    hey , member in nokia support discussions in arabic told me to update software by nokia suite or software update in mobile , but I can't do that now because the Internet has slow, so if you do that tell me pleas and thank you

  • Why GWt suggest box is not working in the latest versions of Firefox ? It was working only in Firefox 3 and not other versions. could you please assist in this regards.,

    Why GWt suggest box is not working in the latest versions of Firefox ?
    It was working only in Firefox 3 and not other versions. could you please assist in this regards.,

    jbren wrote:
    I repeatedly have problems with playback on my STB's. Go thru all the motions, inhouse agent, fix multi room dvr problems. Unplug unit, unplug dvr, etc. etc. etc.  The DVR'd show will play on the DVR but not on the STB's. What's up with that?
    Sorry to hear the auto fix suggested early did not fix your problem. So we can get more information from you, I have copied your post to our private support board. Please refer all correspondences to there from here on out. You can easily get to the private support one of two ways. In the email you signed up for the forums with, you will receive a link to click on. Make sure you are already signed into the forums before clicking on this link. Another way of getting there is by clicking on your username anywhere you see it in the forums. This brings you to your account profile. Scroll down to the section labeled "My Support Cases" . In there you will see the link to your case.
    Anthony_VZ
    **If someones post has helped you, please acknowledge their assistance by clicking the red thumbs up button to give them Kudos. If you are the original poster and any response gave you your answer, please mark the post that had the answer as the solution**
    Notice: Content posted by Verizon employees is meant to be informational and does not supersede or change the Verizon Forums User Guidelines or Terms or Service, or your Customer Agreement Terms and Conditions or plan

Maybe you are looking for