How to return a single datetime from multiple rows of MAX(value) in DAX

Hi
I have a Results table with ResultTime, Balance, Equity which is updated with a new row every 5 minutes. I've used SUMX to find opening and closing balances and it has worked so far.
Res_OpeningBalance:=SUMX(TOPN(1,Results,Results[ResultTime],1),[Balance])
Res_ClosingBalance:=SUMX(TOPN(1,Results,Results[ResultTime],0),[Balance])
But when I tried it with dates, the whole thing fell apart.
Res_MaxBalance_Date:=SUMX(TOPN(1,Results,Results[Balance],0),[ResultTime])
Since the highest Balance is likely to be represented through many rows due to it lasting more than 5 minutes, ResultTime (which is unique to each row) is summed up and returns messed up dates well into the future. How to return only one date (first or last
datetime) from the rows where Balance is at max?
I tried a TOPN of TOPN, but Excel was not amused.
=SUMX(TOPN(1,Results,Results[Balance],0),TOPN(1,Results,Results[ResultTime],0))
TIA!
Re
Dennis

I still don't understand RANKX, but I figured it out anyway. I get the correct data by using:
Res_MaxBalance:=MAX(Results[Balance])
Res_MaxBalanceDate:=CALCULATE(MAX(Results[ResultTime]),FILTER(Results, Results[Balance]=MAX(Results[Balance])))
Res_MinBalance:=MIN(Results[Balance])
Res_MinBalanceDate:=CALCULATE(MAX(Results[ResultTime]),FILTER(Results, Results[Balance]=MIN(Results[Balance])))
Res_MaxEquity:=MAX(Results[Equity])
Res_MaxEquityDate:=CALCULATE(MAX(Results[ResultTime]),FILTER(Results, Results[Equity]=MAX(Results[Equity])))
Res_MinEquity:=MIN(Results[Equity])
Res_MinEquityDate:=CALCULATE(MAX(Results[ResultTime]),FILTER(Results, Results[Equity]=MIN(Results[Equity])))
Re
D

Similar Messages

  • Maps: How to generate a single node from multiple nodes

    Hi,
    I have a problem while mapping. I have a large complex input schema through which I generate a flat file output. I have used map for creating the output. Below is the
    output and expected output.
    Output:
    E,651,120,3999,2013-12-01,2013-12-25,25,556,0.00,0
    E,652,120,3901,2013-12-01,2013-12-27,27,6176.25,0.00,0
    SR,17,120,2013-12-25,2022,122013,2,6732.25,1,01389399501
    SR,17,120,2013-12-27,2022,122013,2,6732.25,1,01389399501
    Expected Output:
    E,651,120,3999,2013-12-01,2013-12-25,25,556,0.00,0
    E,652,120,3901,2013-12-01,2013-12-27,27,6176.25,0.00,0
    SR,17,120,2013-12-27,2022,122013,2,6732.25,1,01389399501
    There should always be one SR node. The node which should be present should be the one which has maximum DATE. While mapping how can I check before hand that there will be more DATE values coming and then map only latest. It’s a complex mapping so I’m looking
    for a simple solution.
    I want some conditions like while generating output SR Node, if there will be various SCR nodes in output then select the node with maximum date value in insert that in output.
    Thanks.

    Thanks for the detailed response Aswin. It's very helpful. Please help in one more condition, sometimes there could be multiple SR with same Date. In that case SR is still repeating as all are equal so above maximun logic is creating n nodes. Eg:
    Output:
    E,651,120,3999,2013-12-01,2013-12-25,25,556,0.00,0
    E,652,120,3901,2013-12-01,2013-12-27,27,6176.25,0.00,0
    SR,218,504420120,2013-10-04,0451,102013,1,393.85,AD,501
    SR,218,504420120,2013-10-04,0451,102013,1,393.85,AD,501
    Expected Op:
    E,651,120,3999,2013-12-01,2013-12-25,25,556,0.00,0
    E,652,120,3901,2013-12-01,2013-12-27,27,6176.25,0.00,0
    SR,218,504420120,2013-10-04,0451,102013,1,393.85,AD,501
    So, if there are maximum in that cas select max, which is working now and if they are same then any one of those.

  • How To Concatenate Column Values from Multiple Rows into a Single Column?

    How do I create a SQL query that will concatenate column values from multiple rows into a single column?
    Last First Code
    Lesand Danny 1
    Lesand Danny 2
    Lesand Danny 3
    Benedi Eric 7
    Benedi Eric 14
    Result should look like:
    Last First Codes
    Lesand Danny 1,2,3
    Benedi Eric 7,14
    Thanks,
    David Johnson

    Starting with Oracle 9i
    select last, first, substr(max(sys_connect_by_path(code,',')),2) codes
    from
    (select last, first, code, row_number() over(partition by last, first order by code) rn
    from a)
    connect by last = prior last and first = prior first and prior rn = rn -1
    start with rn = 1
    group by last, first
    LAST       FIRST      CODES                                                                                                                                                                                                  
    Lesand         Danny          1,2,3
    Benedi         Eric           7,14Regards
    Dmytro

  • How can I create a single order from multiple quotations?

    How can I create a single order from multiple quotations that I have created by the transaction VA21 ?
    Thanks in advance for the answers.

    hi
    Go to transaction: /nva01
    Enter order type : ZOR
    Sale org :xxxx
    Dist.channel:xx
    Division :xx
    Press enter
    Click on “Sale document” and select Create with reference
    Then enter 1st quotation number & click on “COPY” or “Selection list”. Then click on “Copy “.Then all line items which belong to quoation1 copy to order.
    Then,
    Click on “Sale document” and select Create with reference
    Then enter 2nd quotation number & click on “COPY” or “Selection list”. Then click on “Copy “.Then all line items which belong to quoation2 copy to order.
    Then,
    Click on “Sale document” and select Create with reference
    Then enter 3rd quotation number & click on “COPY” or “Selection list”. Then click on “Copy “.Then all line items which belong to quoation3 copy to order.
    Now save the sale document.
    Kindly give reward points
    Edited by: WISH on Mar 19, 2008 2:25 PM

  • How do I create. A single PDF from multiple files? PDF pack on iOS

    How do I create. A single PDF from multiple files? PDF pack on iOS
    The primary reason I signed up for. PDF Pack was to create a single PDF from multiple image files and other PDFs .
    Is this possible? If so how
    thanks in advance
    rich

    Hi Rich,
    The combine files feature isn't available when you're using Reader for iOS. However, you can log on to the web interface at Adobe Acrobat.com using your Adobe ID and credentials, and use the Combine Files feature there.
    Please let us know if you need further assistance.
    Best,
    Sara

  • How can i import the data from multiple sources into single rpd in obiee11g

    how can i import the data from multiple sources into single rpd in obiee11g

    Hi,
    to import from multiple data sources, first configure ODBC connections for respective data sources. then you can import data from multiple data sources. When you import the data, a connection pool will create automatically.
    tnx

  • Any Tutorial / Sample to create Single PDF from multiple source files using PDF assembler in a watched folder process.

    Any Tutorial / Sample to create Single PDF from multiple source files using PDF assembler in a watched folder process. I have a client application which will prepare number of source files and some meta data information (in .XML) which will be used in header/footer. Is it possible to put a run time generated DDX file in the watch folder and use it in Process. If possible how can I pass the file names in the DDX. Any sample Process will be very helpful.

    If possible, make use of Assembler API in your client application instead of doing this using watched folder. Here are the Assembler samples :  LiveCycle ES2.5 * Programming with LiveCycle ES2.5
    Watched folder can accept zip files (sample : Configuring a watched folder to handle multiple input files and write results to a single folder | Adobe LiveCycle Blog ). You can also use execute script to create the DDX at runtime : LiveCycle ES2 * Application Development Using LiveCycle Workbench ES2
    Thanks
    Wasil

  • How to create a pdf file from multiple images ?

    Dear All,
    I want to create a SINGLE page pdf file from two or more page size images that are combined to make a single page pdf. Again, this question is on pdfs that are made out of several, atleast  two color images and a black-and-white mask for one of them.
    I have such pdf files from an unknown source (the producer is edited out) whereby there are three tiff images, obtained using the well known pdfimages extractor.
    When I want to make a pdf out of tiff or png or other image formats, I right click and tell Adobe Acrobat to make a pdf.
    However, I dont know how I can give a command to select say,  three tif images and specify which is the mask for which and then join  them in a way that I get the pdf from the composite of the two color images and a mask for one of them.
    Please help me out.
    I am a little familiar with the pdf structure skeleton and when necessary, fixed xref tables in one of my favorite editors. A few years ago, I also wrote a bunch of javascripts to make some annotations and needed some automation and used some itext type libraries. However, I need your help in this problem as I am now rusty and forgot some of what I studied to solve my earlier problems. This is a new problem for me. Gentle hints from you would be very nice to help me in this problem. Please specify if necessary what manual and pages to read. in the pdfspec.
    Best Regards
    Disabled Veteran [physically handicapped]

    Hello Again.
    On Fri, May 11, 2012 at 12:20 PM, lrosenth <[email protected]> wrote:
    >
    > Re: How to create a pdf file from multiple images ?
    >
    > created by lrosenth in PDF Language and Specifications - View the full
    > discussion
    > ________________________________
    >
    > No clue who Irving is…
    >
    I was hoping to have your first name so its easy for me to address you.
    > I have no clue what OS platform, programming language, etc. you use so
    > can’t really narrow things down.
    I would gladly mention that I am working on windows platform, preferably XP.
    I can also work on linux for free products that come with it.
    >  Also, as this is an Adobe forum, we only
    > recommend Adobe products – so there may be other options that even my list
    > wouldn’t include.
    But adding other products, for the help of an adobe products user,
    even if it outside adobe, shall add greater prestige to your company
    and give impression of user-centeredness.
    > If you read ISO 32000-1:2008 (aka the PDF standard), you will find the
    > information about Images and Image Masks well described.  I didn’t think I
    > needed to repeat any of that information.
    Well, just add the few pdf stanzas since you are proficient on it and
    I am presently a little rusty as I mentioned. Just asking a little
    extra yard, not even to go an extra mile.
    > And, if you read that same document, you will see that there is NO SUCH
    > THING as a “text only PDF”.   All PDF documents are structured binary files.
    Well, ascii format or uncompressed format that is human readable. I
    know its a binary file, but human readable ascii version of it.
    I hope you can give me some stanza and various other approaches
    possible so I can select or combine things for myself. I see only a
    miniscule number of posts claiming to have written masks in this forum
    and then with no details.
    Regards
    Roger
    Message was edited by: dying veteran
    because the adobe posting system went crazy and truncated all except the first line ... dunno why

  • How to Park the single invoice for multiple purchase orders

    Hi,
    How to Park the single invoice for multiple purchase orders?

    brother this is possible to enter one Invoice fro multiple purchase order.
    call transaction MIR7, select " purchase order/Scheduling Agreement" from the PO refernce Tab. then click on arrow. give your purchase orders here.
    Thanks

  • Single delivery from multiple Sales Orders

    Can you let me know how to create a Single DN if there are different parts to be shipped if the below satisfies,
    same ship-to-party
    same ship date
    thx,

    Hi Pri,
    To have single delivery from multiple Sales Orders you have 2 waysto do it.
    The prerequisites are,
    A. All sales orders should have same ship to Party
    B. Delivery due dates should be same.
    C. Incoterms should also be same.
    D. Shipping Point should be same.
    Once this is ensured, you can either
    1. Go to Tr. Code VL10A and execute the delivery document creation for the list of sales orders
    Or,
    2. Go to VL01N. Give 1st order no. enter into the overview screen
    Here, go to main menu, Outbound Delivery ---> Collective Processing- Del. Creation
    This will also take u to the same VL10A screen.
    Hope, this is helpful. Award points if found helpful.
    Regards,
    Niketan

  • How do I send single notifications to multiple people in the workflow?

    HI
    As I see you can send notification to one person at a time.
    For example, the approval notification goes to a approver once someone submits a expense report or po approval.
    How do I send single notifications to multiple people in the workflow?
    Any idea?
    Thanks in advance.

    Hi,
    You need to send the notification to a role, which can comprise one or more than one users. If you check the "Expand roles" checkbox, then a different copy of the notification will be sent to each member of the role; otherwise one notification is sent which can be viewed by all holders of the role.
    You should always send a notification to a role rather than a user, anyway - roles do not go on holiday, get sick or leave the company; users do.
    HTH,
    Matt
    WorkflowFAQ.com - the ONLY independent resource for Oracle Workflow development
    Alpha review chapters from my book "Developing With Oracle Workflow" are available via my website http://www.workflowfaq.com
    Have you read the blog at http://thoughts.workflowfaq.com ?
    WorkflowFAQ support forum: http://forum.workflowfaq.com

  • How to delete a single request from DSO in BI 7.0

    Dear Experts,
    Could you please tell me how to delete a single request from DSO?
    I mean, in DSO if we delete one request it also delete the requests which are above it. But i don't to delete the above it.
    Please suggest me this issue.
    Regards,
    Prathap

    IN DSO--its a very basic thing....
    ACTIVE TABLE and CHANGELOG tables are overwritten after activation of each request.
    So ,each new request has a realationsip with the older request.
    So in the cases:
    1.If you activate the older request it will delete the new one ,because changelog entries have been written from the data of new request on the basis of the older one.
    e.g older request  entries:
    a x 1
    new request
    a x 2
    change log
    a x 1
    a x -1
    a x 2
    so its quite obvious you can't have  a x 2 directly (because in the infocube you will be sending wrong entries by deleting the just the older request and loadning new request).
    2.If you have activate new and old request toghterh then also system will not allow you to delete the newer request alone and you will have to delete both the requests.
    I guess already someone proposed correct solution to you ...thats selective deletion...but rahter than doing selective deletion there is a better way if you want to cancel out a particular request:
    thats request reverst posting
    IN the process monitor of any particular request you can find out the option for request reverse posting..Its good for individual request cancellation(keyfig values will become 0 for that particular request)
    regards,
    rk

  • Can i create a single image from multiple images in lightroom?

    Can i create a single image from multiple images in lightroom?

    Like a panorama, a composite or focus stack? Have you tried the Lightroom forum?
    Photoshop Lightroom

  • How can I remove people tags from MULTIPLE images in Organizer 13?

    How can I remove people tags from MULTIPLE images in Organizer 13?  The strategy for removing keyword tags does not work. It appears that keyword tags and People tags are considered something completely different in 13.  I highlight multiple images, right click, and under keyword tags it says there are no keyword tags. There does not appear to be an option for people or other tags. Can anyone help? It is going to take literally hundreds of hours for me to do this one photo one tag at a time.  ??

    Comp. 792 wrote:
    Hi, my linked images all have dashed lines at the bottom of the images. I searched for an answer and someone said to add:
    img a {text-decoration:none:}
    to the end of my CSS,
    That CSS is complete nonsense. The correct way to remove borders from around links is here: http://forums.adobe.com/thread/417110.
    If you want to get rid of dotted lines, they are almost certainly caused by the outline property. However, outlines around links are there for a reason: it provides a visual "you are here" clue to people who navigate the web with the keyboard, either through preference or because of disability. You shouldn't remove the dotted outline without providing a different visual clue.

  • How to create a Sales order from multiple quotations?

    Hi All,
    Please tell me how to create one sales order from multiple quotations?
    Regards,
    Maddy

    Hello Maddy,
    To create the sales order from multiple quotation, you should put the value "F - Only at item level: Always with selection option" under Quotation determination in your sales transaction type.
    It will give you a pop-up to choose your quotations item while creating the sales order.
    Some per-requisites are there:
    1. Copy control should be maintained between your quotation and sales order.
    2. Quotation should be error free and should have the status "Released"
    3. Sold to party and Organization should be same in both transaction.
    For more information you can check the below link:
    Processing Quotations - Sales Transactions - SAP Library
    Best Regards,
    Dinesh

Maybe you are looking for

  • How to send report using OBI EE Delivers to NON-OBI EE users

    Help!!! I have followed all the instructions posted. I have setup SA Systems. Delivers / iBots works using our SA_SYSTEM_USERS table. Yes, I have the column names correct. Yes, have setup the iBot correct. I have a list of 4 users. 2 users are vaild

  • Photoshop Elements 10 Mac Ongoing Install Failure - Exit Code 7

    Photoshop Elements 10 Mac Ongoing Install Failure - Exit Code 7 I downloaded Photoshop Elements 10 for Mac (not trial, with valid serial #) Mac OSX 10.7.2, 3.6 GHz Intel Core i5, 16 GB RAM I know the install package is valid because I installed it on

  • Macbook pro fan suddenly running more

    i've had my macbook pro for about 3.5 years.  last year, the battery was replaced.  it's been running fine but suddenly i notice the fan running a lot more.  first it was when i was using my screen saver which is an aquarium - it used to run silently

  • Activate u201CUpdate all Currenciesu201D in Controlling

    Dear All, We have data since 2008 but without the u201CUpdate all Currenciesu201D in the controlling area. What we need to do in order to activate it. The SAP documentation refers: "If there are values in the controlling area or on orders, you should

  • Programatically Selecting Tab

    Hi, I want to select a tab programatically on click of button. I set the showDetailItem disclosed property programmatically on click of the button and it works fine. Now if user selects some tab and then they click on this button then the programatic