Count of occurace of a specific text in between rows

ROW
SESSION
1
Application Started
2
Application Aborted
3
Application Ended
4
Application Started
5
Application Started
6
Application Ended
7
Application Ended
8
Application Started
This is a sample data taken from an External Excel Sheet.
Our motive is to count the occurrence of "Application Ended" in between "Application Started". and return the desired output as below.
S NO.
Count of Application Ended between application starts
1
1
2
2
Is it possible to achieve this using Power Query. Please help.

Hi,
Base on this sample, you can use below code :
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Index = Table.AddIndexColumn(Source,"Index"),
    Position = Table.AddColumn(Index, "Position", each if  List.Contains( List.PositionOf(  Source[SESSION] , "Application Started" ,2), [Index]) then [Index] else null ),
    DuplicatedColumn = Table.DuplicateColumn(Position, "Position", "Temp"),
    FillUp = Table.FillUp(DuplicatedColumn,{"Temp"}),
    InsertedCustom = Table.AddColumn(FillUp, "Custom", each  try if [Position]=[Index] and FillUp {[Index]+1}[Position]<>null then [Temp] else FillUp {[Index]+1}[Temp] otherwise [Temp] ),
    RemovedColumns = Table.RemoveColumns(InsertedCustom,{"Index", "Position", "Temp"}),
    GroupedRows = Table.Group(RemovedColumns, {"Custom"}, {{"Count", each List.Count( List.Select( _[SESSION], (lst)=> lst= "Application Ended" ) ), type number}}),
    RemovedColumns1 = Table.RemoveColumns(GroupedRows,{"Custom"}),
    InsertedIndex = Table.AddIndexColumn(RemovedColumns1,"S NO ", 1,1 ),
    ReorderedColumns = Table.ReorderColumns(InsertedIndex,{"S NO ", "Count"})
in
    ReorderedColumns
I also make sample file and share in my one drive as below :
https://onedrive.live.com/edit.aspx?cid=94B99C319E63236A&resid=94B99C319E63236A%21337&app=Excel
Regards,

Similar Messages

  • Inserting static text in between rows returned from a pivot table

    Is there a way to type static text (eg. “Note that the data for Land has an accuracy of 98%”) in between rows returned from the dataset in the rtf template. The alternative would be to break the BI analysis report (which is the source of the template data) into 2 parts and then insert each part into the template one below the other with the text typed in between.

    Oracle support has confirmed that this requirement is not possible to implement

  • Check if a cell contains specific text

    I am trying to do a check to see if a cell contains specific text (but may also include other text). I thought this might be accomplished with an 'if' statement. Is this possible in Numbers?

    I am assuming the word "carrot" can appear multiple times within the same cell so the COUNTIF function will not work for this case.
    Set up an auxiliary (second) table that is the same size as your "matrix". Each cell in this new table corresponds to a cell in your "matrix". Each of these cells will count how many times "carrot" appears in the corresponding cell of the "matrix". The formula below will count how many times the letters "carrot" appear in that exact order in a cell. In other words, "carrotstick" is also included in the count. Capitalization is not a factor. It assumes your "matrix" top left corner is cell B2 of Table 1.
    Table 2 cell B2=(LEN(UPPER(Table 1 :: B2))-LEN(SUBSTITUTE(UPPER(Table 1 :: B2),UPPER($A$1),"")))/LEN($A$1)
    Copy or fill that formula to the rest of the cells.
    Table 2 cell A1 = carrot (the word you are looking for)
    Somewhere else have a cell that sums the cells in Table 2.
    The formula works by removing all instances of the word "carrot" from the string then subtracting the length of the new string from the length of the original and dividing that by the length of the word "carrot". The result is the number of times "carrot" appears in that particular string.
    You could put a space before and/or after "carrot" in cell A1 to avoid counting words such as "carrotstick" but if "carrot" is the first and/or last word of the string, it will not get counted because that space will not be there in the string.
    Message was edited by: Badunit

  • Can I add specific text to Template via pop up text box on opening file?

    In most word processors it is possible to create a template that asks you for specific text when you open it, so that you can have the letter three quarters written within the template, and only need to replace names, addresses, date and so on.
    In Lotus WordPro for instance, before I even see the file, I have to fill in a dialogue box with the persons name, the subject of the letter, and four or five specifics unique to them. The WP then adds this info into the letter, and all I need do is to occasionally write a further full paragraph.
    How do I do this in Pages? I can't seem to find anyway to do it at all. I have a suspicion I might need Apple Script, but I'm not sure how I can do that. I have a book of how to code, but I don't know where to store the macro, nor to write it yet - the book's just there if I need it.
    I want to open the file, and then be asked one item at a time for the personalised answers to questions that occur in every report/letter.
    Any ideas?
    TIA
    Mac

    Thanks for your suggestions, Magnus, you really have had a good think for me - I appreciate that!
    What I am doing is report writing in which 90% of the report is the same for everyone. Except the cover page with Name and Address details, and Report title; the initial section which is the same for everyone except for specifics such as amount to invest, reason for investment, term to invest over, things like that.
    The end of the report is the recommendations section which is where I use freetext to create a bespoke solution - this cannot be automated.
    Just automating the cover page and the intro section save me huge amounts of time which I can then use on research and fund analysis, leaving the principles of investment section pretty much the same for everyone, as here I'm describing the principle and theory.
    After I created this Report Template my average report creation time went down from about 3 to 4 hours, to about 45 minutes. I guess the automation itself doesn't save as much time as the templating does, but it allows me to concentrate on the important bit and not worry if I have left something out - or in - that changes the overall thrust of the report.
    I cannot load Lotus WorpPro on Parallels, nor on Virtual PC, so the lack of automation really is a pain here. I see it as a weakness of Apple products for business, as I am sure Microsoft do which is why they have dropped VBA support for Office 2008.
    I have got NeoOffice as well as OpenOffice for Mac on my system, but really they aren't atable enough to use, and the formatting is pretty flaky. It certainly isn't completely consistent with Office itself.
    So, I am left with the conclusion that progress only means a reduction in features!
    But maybe I'm missing something?
    Mac

  • Can you create a button that adds specific text to a form field?

    Hi,
    I was wondering if it was possible to create a button in a PDF that, when clicked, adds specific text to a form field?
    I am trying to make a product catalogue where you click on a product button to add the product name or code to a form field.
    Each product in the catalogue will have a button and the more you click the more is added to the form field(s).
    Then when you have finished adding products to the form field(s) I want to be able to save and email the entire PDF as an order form.
    Any thoughts would be appreciated!
    Cheers,
    Jim

    Yes, it's possible. The most simple version of such a script will be something like this (used as the button's MouseUp event):
    var v = this.getField("Products");
    if (f.value!="")
         f.value += ", ";
    f.value += "Product1";

  • How do I find and remove specific text in a PDF document?

    hi. sorry for my english (i am from russia))
    there is the problem - how do i find specific text in a document (in my case, it - all numbers (0-9)) and delete it, using javascript??
    And I would like to know also - is the a search function with regular expressions??
    And most importantly - how to remove the founded text???
    is it possible?
    document is so big, that if I manually delete the numbers - I will do it for a month!!))
    Thank you!!!!

    Thanx!!!
    that is, if there are entries in document "hello 1234", then the search all words will identify it as two words "hello" and "1234". and then I check with regular expressions where the numbers.. ?
    ps. and I have not found yet any command, that replace the founded text from javascript))
    yes.. in acrobat X pro.. tools-protection-search&remove is also avaible....! (but, no regular in search string.. to bad...)
    thank you!

  • Cycle Count Entries Form not showing specific employee name in "Counted By" LOV List

    Cycle Count Entries Form not showing specific employee name in "Counted By" LOV List.But the Employee is active . Is there any setup for this activity?

    Hi,
    This is because the query is excluding the current site you are trying to modify since it is actually in the report.
    You can include in your query:
    or site_id = :Pxx_SITE_ID
    Where Pxx_SITE_ID is the item holding the site_id value and xx is your page number.
    Thank you,
    Erick

  • Looking for an app that will alarm on specific text messages.

    Looking for an app that will alarm on specific text messages. The idea is to use the message as a pager without a monthly subscription. There is a similar app for andriod called firealert.

    I could not find any app that would do this. There are different types of message apps but nothing that I could find to do what I am looking for. For a specific contact I would like the message to have a notification that will not go away until I acknowledge it. Just like you would do if it was a pager.

  • Use smart mailbox to find email with specific text in attached pdf

    Does anyone known if a smart mailbox can be created to find emails with specific text within a pdf attached document. I know that spotlight can do this and it works fine but it would suite me better to be able to do this in mail.

    After some digging, I found that Spotlight returns the pdf attachment (found within the library/mail/download folder), but not the actual email. The only time it returns the email is if the search text or numerics are coincidentally within the written contents or subject line.
    Yes, i have tried setting up smart mailbox search criteria using the entire message contents but this does not find emails where the text exist within the pdf.
    I've checked spotlight pref.'s and all categories are checked off.
    Essentally, i need the smartbox search criteria to return results where the search text is found within the pdf attachment if possible. If this is not possible, i'll continue using spotlight searches outside of mail.
    I appreciate any help you can offer.

  • How do I surface language specific texts in Integrated ITS?

    Hello all,
    I'm new to both stand alone and integrated ITS and am researching the upgrade process. In our stand alone templates we used htrc files with our html templates to show language specific texts.
    Example.
    html template code for a field label
    `if (i==2) DETAIL-FLABEL[2]= #KAFN end`
    htrc name value pair
    z_pz01_en.htrc
    KAFN     Known As First Name
    z_pz01_de.htrc
    KAFN     Bekannt unter dem Vornamen
    I see no hint that htrc's can be used in integrated and am not seeing anything in the way of resource based language texts in integrated. I think I've hit every document out there yet, I have a feeling I'm missing something obvious. Your help is appreciated.
    Doug

    Edgar,
    Thanks so much for the detail!
    I have run through the steps for manual creation of translations as well as SIAC_UPLOAD of htrc files and have it working and documented. I will add a few more findings here for others who find this post later.
    Some of our old htrc files had duplicate keys (probably from original German version). In stand alone ITS the last key in the file was used so this didn't matter. In integrated ITS this matters for 2 reasons.
    1 Uploading/Converting htrc files having logged in in English will cause failures if any of the text being entered in the service parameters has characters that arent consistent with the codepage being used for EN. (Ex. back Azureück). Clean up htrc files to use only the language they should contain.
    2 Stand alone ITS was forgiving of htrc files containing duplicate keys. Integrated ITS is not. Remove all duplicate keys.
    3. This one is obvious but... if  parameters have already been entered in another language you may be prompted to confirm you are changing language and there are several prompts along the way. As these prompts will appear in the logon language itu2019s important to eitheru2026
    a. Be fluent in all supported languages , oru2026
    b. Memorize button and menu positions.
    I do have one additional question.
    Our old stand alone setup had an alternate corporate "APCI" design that we used...
    File system view -
    hostDEV_WWWmimesdesigns"apci"webgui as opposed to the out of box
    hostDEV_WWWmimesdesignssap_streamlinewebgui I suppose.
    I believe this was then referenced in the global services file ~DESIGN="APCI"
    I'm starting research to understand if there is an analog to this in the integrated webgui service or precisely what I have to do to accomplish alternate styles for webgui and our Z_services.
    Thanks again, points on the way, If I could award more I would.
    Doug

  • How to check if there is specific text in a word document ?

    Hello everyone ,
    I have a form include text box1  , I need to check a word document if  there is specific text inside it , if it’s true the textbox1.text = 1 , if it’s false the textbox1.text = 0 , and so on .
    to be clear I’m trying to check a lot of things not just specific text also ( font size , font color , font type , photo , table …………etc ) .
    I read a lot of threads about Office Automation , all about how to create a new documents and insert text tables photos….. etc, but what I need just to check if it existing or not
    Any idea , books, threads ,examples ….
    Thanks in advance.
    Visual Studio 2013
    office 2007

    "1- what if i need to check that word in the beginning of the second paragraph in that document or at the end of the third paragraph "
    to find a word in a paragraph, use the range keyword as in
    Dim rng As word.Range = objDoc.Paragraphs(1).Range
    rng.Find.Execute(FindText:="yourtext")
    " can you give me any website or books , to learn how to check  ( font size , font color , font type , photo , table
    …………etc ) and return with (1,0) or (true ,flase)."
    You can use the range object here aswell
    If rng.Font.Size = 7 Then TextBox1.Text = 1
    Look at this link for a multiple of examples about word automation
    https://msdn.microsoft.com/en-us/library/78whx7s6(v=vs.80).aspx

  • Search Help in Webdynpro displays specific text in German language

    We have created a custom search help which is being displayed using a custom Webdynpro application. We found that for this search help, although all other texts are displayed in English, a specific text ( 'Show filter criteria' ) is being displayed in German. Also, the same problem exists for search helps used in certain standard Webdynpro applications as well ( eg. WDT_FLIGHTLIST, TEST_DDIC ). Is there any SAP note to address this issue?

    Hi,
    see SAP note 1050954
    Regards, Heidi

  • How to search specific text/string in pdf files from command prompt?

    Hi,
    How to search specific text/string in pdf files from command prompt?
    Will be great if you can refer to any adobe provided command base utility to achieve the above target.
    Best Regards,

    You can't. The commandline parameters for Acrobat and Adobe Reader do not allow any type of commands to be run.

  • How can i define a boolean variable with the condition if i got a specific text on a selected column?

    How can i define a boolean variable with the condition if i got a specific text on a selected column?
    Example:
    my select results:
    [id = 102] [Company = 'Microsoft']
    If i got microsoft in 'Company' i want to my another table with the columnName "Microsoft" get "true".
    Can you help me?

    That is called 2-table UPDATE.
    Example:
    http://www.sqlusa.com/bestpractices2005/updatewithcorrelatedsubquery/
    Kalman Toth Database & OLAP Architect
    Free T-SQL Scripts
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Exchange Server 2013 - Mailflow - Transport Rules - Forwarding Emails with Specific Text to Another Email Address

    Hi There,
    We are soon to implement Exchange 2013.
    Question: Is it possible to have emails with specific text such as "..SND.." to an other email address specified as well as the original recipient?
    Thanks very much.
    Lisa.

    Hi Amit,
    Thanks for answering my question. I have one more. To enable rules like this do you need to have an Exchange Edge Transport server installed or is this configured from an admin console within Exchange itself?
    Thank you,
    Lisa
    Lisa Stanley

Maybe you are looking for

  • Transfer of sales orders from one plant to another

    Dear all, My requirement is as follows: I have created some 500 sales orders (open) in one sales org+plant. Now due to plant shifting to other area, I want to transfer all the above open sales orders to another sales org+plant. One option is to creat

  • Using j_security_check container authentication with JSF

    Hi All, After quite a bit of looking around, we resorted to using a plain login JSP page with a ServletFilter on j_security_check to have container managed authentication in our JSF based web-site using IBM Websphere 5.1 So, basically every other pag

  • Classical Report

    Hi Experts, I have developed classical report.in my internal table, i have 24 records. my question is, in ALV report,we can display colors as zebra color autometically by function module. but in classical report.how can we set zebra color for my 24 r

  • Cursor for loop vs bind variable efficiency

    PL/SQL I am going to need to execute many sqls within a cursor for loop. Note: This is pseudo pl/sql code for csr_rec in cursor loop insert into tablea select [whateever] from tableb where column_name = csr_rec.field versus execute immediate 'insert

  • Safari Pop up?  Is this windows?

    I was wondering if anyone else has ever had this on a mac. I am familiar with it on windows but never had it on a mac before. Once every couple of days while surfing I get a pop up that says I need to download this cleaner immediatly, adult sites fou