Modify MDX query so it only shows specific dates?

I'm new to SSAS and SSRS reports (with datasource an SSAS cube), so please bear with me.
So I created a basic report that gets the data from my SSAS cube and displays it. That is working well. The problem is that the parameter displays the Dimension [Dim Date].[Date Key] so the dropdown displays every single day in the dimension table.
One of my datasets in the report is a hidden dataset called [DimDateDateKey]. This is the dataset used to display all the values in the datekey dropdown parameter. The MDX query looks like this:
WITH MEMBER [Measures].[ParameterCaption] AS [Dim Date].[Date Key].CURRENTMEMBER.MEMBER_CAPTION MEMBER
[Measures].[ParameterValue] AS [Dim Date].[Date Key].CURRENTMEMBER.UNIQUENAME MEMBER
[Measures].[ParameterLevel] AS [Dim Date].[Date Key].CURRENTMEMBER.LEVEL.ORDINAL
SELECT {[Measures].[ParameterCaption], [Measures].[ParameterValue], [Measures].[ParameterLevel]} ON COLUMNS ,
[Dim Date].[Date Key].ALLMEMBERS ON ROWS FROM [Sales cube]
My question is, how can I modify this query so that it only displays dates that are between today and 5 days ago? The column [Dim Date].[Date Key] is of type INT, so it would only display 20141012 and 20141017.
Currently, it displays every single [Dim Date].[Date Key] of the table, which is from 20000101 to 20201231.
Thanks.
VM

Hi VM,
you have to dynamically filter data based on current date. Current date you can get using VBA function now().
I enclose code adjusted code sample you pasted, but because I don't have same cube as you do, I wasn't able to execute it. Anyway it should work or at least you should see there that principle
WITH MEMBER [Measures].[ParameterCaption] AS [Dim Date].[Date Key].CURRENTMEMBER.MEMBER_CAPTION MEMBER
[Measures].[ParameterValue] AS [Dim Date].[Date Key].CURRENTMEMBER.UNIQUENAME MEMBER
[Measures].[ParameterLevel] AS [Dim Date].[Date Key].CURRENTMEMBER.LEVEL.ORDINAL
SELECT {[Measures].[ParameterCaption], [Measures].[ParameterValue], [Measures].[ParameterLevel]} ON COLUMNS ,
[Dim Date].[Date Key].ALLMEMBERS ON ROWS FROM
(SELECT {StrToMember("[Dim Date].[Date Key].&[" + Year(now()) * 10000 + month(now()) *100 + day(now()) + "]"):
StrToMember("[Dim Date].[Date Key].&[" + Year(now()-5) * 10000 + month(now()-5) *100 + day(now()-5) + "]")}
ON COLUMNS FROM
[Sales cube]
Jiri Neoral

Similar Messages

  • How to show specific data for user on redirected page once they logged in

    I and fairly new, but have a general understanding of Dreamweaver. Using CS3 or CS4, how do you get the redirected page after the user logges in to show only the data for that user? I have creater the login page and it works fine but i dont know what needs to be on the redirected page for it to show only the data for the user that just logged in.
    I am not very good with the coding part so if it requires it any help with that would also be helpful.
    thank all.

    I should be able to get the understanding if explained.
    As for scripting i believe its PHP. at lease thats the page i created the login page with.
    As for user-specific information: basiclly there account information.
    As for database i have dreamweaver linked to a MySQL database. it pulls from 2) tables
    1st table has the following: ID - User Names - Password  - account number
    2nd table has the following: ID - account number - names - address - ect
    So basiclly i want when a user loges in for it to redirect them to a page which then only shows the data for that users. if i can link the data the pulls up by the account number that would be ideal
    Thank you Murry

  • My apple tv only shows retreaving data... since i replaced computer hard drive. Do i need to resync and how?

    My apple tv only shows retreaving data... message after I replaced my computer hard drive. I have unplugged tv to try to get to connect. I have home sharing turned on but still no connection.

    If you've changed the computer hard drive AppleTV may see this as a different computer but in theory if Home Sharing is enabled it may not matter.

  • Report from SQL Query -Excel format only show the first page

    Hi,
    I have some Reports from SQL Query. In the display options, I choose Excel as default format. The Excel documents only show the first page. If I choose HTML as default format, it shows every rows.
    Please advise on how to have a complete Excel document as HTML format does.
    Thanks a lot.
    Lina Han

    I beleive when you export Oracle reports to Excel it is the Data that is transferred along with Column Names.
    You cannot export the variables defined on the report.
    Hence you will not be able to export the Footer to excel. (Still looking into it will let you know if i find anything interesting)
    Regards,
    Bhushan Salgar

  • MS SQL database needs to run mdx query to analysis services to retrieve data from a BPC 10 Netweaver cube(view only)

    We are in the process of migrating from BPC7 SP12 Microsoft sql server to BPC10 netweaver on a sql server with BW7.4 and need to integrate our home grown data warehouse which is on a Microsoft sql server.  The data warehouse currently connects to BPC7 using integration services/analysis services and runs mdx queries to analysis services to retrieve data from the BPC7 cube (view only).  Please provide documentation on how to create this same integration with our data warehouse using BPC10 netweaver on a sql server.

    When you were setting up your ODBC data source for
    the Text driver, did you click on the "Options"
    button? There's a lot of options in there that I
    didn't understand at first glance.Yes I clicked on the options button, but the only thing there is dealing with file extensions. I left it set to the default.
    I have since tried closing my connection after I insert a record, I then try executeQuery, but still no luck. Seems strange that I can write to the file but not read from it. If any thing I'd expect the opposite problem.
    I have also tried using the class "JoltReport" from the sun tutorial instead of my own with the same result.
    Message was edited by:
    Hentay

  • Query on multiprovider not showing correct data

    Hello Gurus,
    I have to display 3 keyfigures in my report.
    Each key fig comes from different data targets.So I have used a multiprovider for it.
    The key figs are namely
    1)Actual sales value 2)forecasted value and 3)Annual target and are in one structure .
    the first and second keyfigure shows data 0calmonth wise(when drill across) which is correct.
    The third key figure should be displayed only at the end .But right now the third key figure column is seen
    in each column when drill down monthwise.
    Is there any way bu which I can only show the values of 'Annual Target'at the end.
    Please suggest on this.

    Hi,
    You can try using Cell Definition in BEX, try to search on SDN and you will find the step by step instructions of doing the same.
    Regards,
    Arminder

  • Query to search between two specific dates and time period

    Hi,
    Need a query to search between two particular dates and time period
    Like i want to search table having one date field .
    Suppose the date range is '01-JUL-06' and '01-AUG-06' and time frame
    is 23:00:00 to 08:00:00
    i.e i want to search between dates 01 july to 01 aug and also within the time frame i.e 23:00 to 08:00 hrs only

    The general principle is
    SELECT * FROM your_table
    WHERE some_date BEWTEEN to_date('01-JUL-06') and to_date('01-AUG-06' )+0.99999
    AND  ( some_date <= trunc(some_date)+8/24
               OR  some_date >= trunc(some_date)+23/24 )
    /Cheers, APC

  • Want a query to see only the changes data of a specific no.

    here are the table sturcucture and data for the table:
    create table import_lc (
    LC_NO varchar2(20),
    AMEND_NO varchar2(2),
    USANCE_PERIOD number,
    AMT_FCY number,
    AMT_LCY number,
    SHIPMENT_PERIOD number,
    EXPIRY_DATE date,
    EXPIRY_PLACE varchar2(50));
    Insert into FE_IMPORT_LC
    (LC_NO, AMEND_NO, USANCE_PERIOD, AMT_FCY, AMT_LCY, SHIPMENT_PERIOD, EXPIRY_DATE,
    EXPIRY_PLACE)
    Values
    ('1', '1', 90, 10000, 500000, 15, TO_DATE('02/13/2008 00:00:00', 'MM/DD/YYYY
    HH24:MI:SS'), 'DHAKA');
    Insert into FE_IMPORT_LC
    (LC_NO, AMEND_NO, USANCE_PERIOD, AMT_FCY, AMT_LCY, SHIPMENT_PERIOD, EXPIRY_DATE,
    EXPIRY_PLACE)
    Values
    ('1', '2', 90, 10000, 500000, 30, TO_DATE('03/13/2008 00:00:00', 'MM/DD/YYYY
    HH24:MI:SS'), 'DHAKA');
    Insert into FE_IMPORT_LC
    (LC_NO, AMEND_NO, USANCE_PERIOD, AMT_FCY, AMT_LCY, SHIPMENT_PERIOD, EXPIRY_DATE,
    EXPIRY_PLACE)
    Values
    ('2', '1', 90, 15000, 800000, 30, TO_DATE('01/19/2008 00:00:00', 'MM/DD/YYYY
    HH24:MI:SS'), 'DHAKA');
    Insert into FE_IMPORT_LC
    (LC_NO, AMEND_NO, USANCE_PERIOD, AMT_FCY, AMT_LCY, SHIPMENT_PERIOD, EXPIRY_DATE,
    EXPIRY_PLACE)
    Values
    ('2', '2', 120, 20000, 1000000, 30, TO_DATE('01/19/2008 00:00:00', 'MM/DD/YYYY
    HH24:MI:SS'), 'DHAKA');
    COMMIT;
    NOW, if u see the table data, u see,
    for lc_no=1; only the shipment_period and expiry_date has been changed with the
    amend_no.
    NOW, if u see the table data, u see,
    for lc_no=2; only the amt_fcy and amt_lcy has been changed with the amend_no.
    there could be many more columns like these where the data can change with the
    amend_no but the lc_no will be the same.
    now, i want to make a query by which i can see only the changes column value for a
    particular lc_no and maximum amend_no for that lc_no.
    & result data should be from the maximum amend_no for that lc_no.
    like:
    for lc_no = 1 ;
    SHIPMENT_PERIOD EXPIRY_DATE
    30          13-03-2008
    And for lc_no = 2 ;
    USANCE_PERIOD     AMT_FCY     AMT_LCY
    120          20000     1000000

    I'm not sure that I completely understand your requirement, but here's something that should, at the very least, get you started. If you don't know what the LAG function does, look it up in the documentation.
    SELECT lc_no,
           amend_no,
           usance_period,
           amt_fcy,
           amt_lcy,
           shipment_period,
           expiry_date,
           expiry_place
    FROM   (SELECT lc_no,
                   amend_no,
                   CASE
                     WHEN usance_period <> LAG (usance_period) OVER (PARTITION BY lc_no ORDER BY amend_no) THEN usance_period
                   END usance_period,
                   CASE
                     WHEN amt_fcy <> LAG (amt_fcy) OVER (PARTITION BY lc_no ORDER BY amend_no) THEN amt_fcy
                   END amt_fcy,
                   CASE
                     WHEN amt_lcy <> LAG (amt_lcy) OVER (PARTITION BY lc_no ORDER BY amend_no) THEN amt_lcy
                   END amt_lcy,
                   CASE
                     WHEN shipment_period <> LAG (shipment_period) OVER (PARTITION BY lc_no ORDER BY amend_no) THEN shipment_period
                   END shipment_period,
                   CASE
                     WHEN expiry_date <> LAG (expiry_date) OVER (PARTITION BY lc_no ORDER BY amend_no) THEN expiry_date
                   END expiry_date,
                   CASE
                     WHEN expiry_place <> LAG (expiry_place) OVER (PARTITION BY lc_no ORDER BY amend_no) THEN expiry_place
                   END expiry_place,
                   rn
            FROM   (SELECT lc_no,
                           amend_no,
                           usance_period,
                           amt_fcy,
                           amt_lcy,
                           shipment_period,
                           expiry_date,
                           expiry_place,
                           ROW_NUMBER () OVER (PARTITION BY lc_no ORDER BY amend_no DESC) rn
                    FROM   fe_import_lc)
            WHERE  rn <= 2)
    WHERE  rn = 1

  • How to make Outlook 2013 calendar only show specific hours and hide the others that are grayed out

    I’d like to show 7am to 10pm thus allowing the rest of the day to be less cramped vertically on my screen.  I don't want to see all the grayed out hours which are
    outside of business hours.  How can I do this?

    Right click on the time scale and choose the next smaller scale. It may not help much since 7 -10 is a fairly long period, although with 30 min and the ribbon minimized, i see 7a - 11p on a 24" monitor. You may need to set 7 as the start of your business
    day. If you have it set later in options, outlook will start the day at the later time.
    I have screenshots here -
    http://www.outlook-tips.net/tips/tip-503-display-work-hours/
    Diane Poremsky [MVP - Outlook]
    Outlook & Exchange Solutions Center
    Outlook Tips
    Subscribe to Exchange Messaging Outlook weekly newsletter

  • Is it possible to modify the Calendar object to only show working days?

    Is there a way to configure the Calendar selection, duration calculations, and notification dates in the system to only include working days (i.e. holidays and weekends are not counted and not available for selection)? This is particlular for Purchasing and Sourcing Modules.
    Thank you.

    This can be changed through registry:
    https://msdn.microsoft.com/en-us/library/ff800821%28v=ws.10%29.aspx
    You can do the change through group policy preferences, or some other method you prefer (ConfigMgr compliance settings for example).

  • List Builder only shows 1 data set at a time

    Am attempting to get a list builder to display multiple data sets but am hitting a wall.  When a 1st data set is selected then all OK.  Add 2nd data set and update list and only 1st is shown.  Remove 1st and update and data is refreshed to 2nd list.  Add 3rd and repeats itself and so on.  Looks like all OK based on the sample but built from scratch and think missing something simple in the destination range (although appears fine).  thoughts?

    Can you describe this in more detail? 
    How are your datasets defined in your excel model and how are your target cells formatted?
    How are you trying to display the two resultsets in list builder in the first place?  The cell range has to be contiguous for list builder to work.

  • Date Field in the Index when Apending Emails to PDF only shows received date

    Hi,
    I have Adobe Professional X with Outlook 2010 and I need to create a pdf with an index of about 1300 emails that are a mix of send and received items.  For legal reasons I need to be able to sort them by sent date, however there is only one date field visible when I look at the columns in the pdf.  this field seems to be the received date.
    Does anyone know anyway to change this or to add another field so that I can see the send date of emails?
    Thanks
    Lance

    Hi,
       Hi segment E1P0000 is standard segment, you will not be able to make any changes. As per requirement you need to create the z<segment> with required field and assign the corresponding data element(as per your data type requirement).
    Thanks,
    Asit Purbey.

  • Only update specific data between 2 ODS

    I have 2 ODS ( with transfer rules between them).
    I have  DATE and period in the Source ODS1 , and I want to update only the register that the month of the date is equal to the period.
    I create a rutine in the field DATE in the transfer rules:
    <u><i><u>
    if COMM_STRUCTURE-DOC_DATE+4(2) EQ COMM_STRUCTURE-/BIC/Z99PERCON.
    result value of the routine
    RETURNCODE = 0.
    if abort is not equal zero, the update process will be canceled
      ABORT = 0.
    endif.</u></i></u>
    But it doent work. Becase the ods update all the data.
    How can I do it? Is it correct in the transfer rules from the SourceODS to the second ODS?
    thanks a lot

    Hi,
    try this.
    if COMM_STRUCTURE-DOC_DATE+4(2) EQ COMM_STRUCTURE-/BIC/Z99PERCON.
       RESULT = <thedate>.
       RETURNCODE = 0.
    ELSE.
       RETURNCODE = 4.
    ENDIF.
    if you set the returncode to 4, the record will be skipped; is that your requirement?
    hope that helps
    Olivier.
    if abort is not equal zero, the update process will be canceled
    ABORT = 0.

  • How come Apple Pay only shows time date city state for my transactions with it? It doesn't even show the name of the store or the amount-

    Using two separate Chase Visas, Apple Oay is working fine but the transaction list is very generic. It lists time, date, city, state and two dashes where amount should be. Shouldn't it at least show the name of the store and the amount?

    Hi.  I don't know if this will help, but I had this problem too.  Mine quit working after I used earbuds.  I was told that there is a switch inside the earbud port that tells the device to divert sound to earbuds.  This can get "stuck" and the device keeps thinking the earbuds are plugged in.  After reinserting the earbuds a few times, the switch was released and my speakers started working again.
    I'm not a techie.... this is just what I found to work after my iPhone 4S speakers quit.

  • Auto index only shows partial data

    Hi everyone,
    Please see the attached file.  I've added notes where the data goes missing.  I know it has something to do with auto-indexing and I spent quite a bit of time reading about it and trying different things but I really need some help now please.
    Thank you!
    Solved!
    Go to Solution.
    Attachments:
    For forum.vi ‏47 KB
    For forum.xlsx ‏12 KB

    Think about what you're trying to do.
    You have three arrays you're indexing.  Let's say they're lengths 1, 2, and 3.
    In the first iteration, we'd index 0 and get back a value from all three.
    In the second iteration, we'd index 1 and get back two values and have a bounds conflict.
    In the third iteration, we'd index 2 and get back a single value while having two bounds conflicts.
    Anything you process in the second and third iteration is garbage.  You have bad inputs so the output isn't useful to you.  In some languages, this will throw an error at runtime for indexing out of bounds.  Some will just let you process the garbage.  In no case do you WANT to run this.
    If you want to process all the elements of the array of size 3, you need to fill in values for the first to arrays to make them all have a length of 3.  Once you do that, the loop will run as you desire.  If you have auto-indexed tunnels with fewer elements than the constant you wire, they will override the terminal, as they should.

Maybe you are looking for

  • How to schedule an appointment with a contact that does not have an e-mail address

    I want to use MS Office Outlook to schedule appointments with clients that may not have an e-mail address. They way appointments are made at our office is that a clients calls to ask for an appointment, the appointment book is consulted for the open

  • How to reverse the TECO

    Can any one let me know that wats the procedure to reverse the TECO.

  • Cange chord strips for smart guitar

    Hi, I am looking to change the selection of chords in the smart guitar, but idot know how. I would like to add an A Minor. Can anyone help me configure the chord strips? Thanks, Michael

  • Formula: If X category then X finish date

    Hello all,  I need a formula that allows me to select a value in one column (column labelled 'importance') which then changes the finish date (column labelled 'finish').  I have created an 'importance' column in which I can select values such as 'urg

  • Weblogic Startup Problems

    We had a problem where we started Weblogic 8.1, while receiving internet traffic(we did not know the web server was still accepting requests at the time). When the server started, it ran for a few minutes and then locked up completely(did not shutdow