Create custom column in power query

Hello All,
I have a requirement to create report for the Analysis, my raw data looks like below which I'm extracting from multiple tables. I would like to extract project wise number count  based on status, my idea is to create custom columns to write the value
if the value matches to the condition else blank. Example my status has multiple status value ( closed, on-hold,warranty,inprogress,etc) i need to know what formula will help me extract data in different columns so that i can get the count in pivot for each
status)
NUMBER         CATEGORY                                Internal SLA  
    EXTERNALSLA      DATE_ENTERED    STATUS
C1000001    HEINEKEN                                    t             
                 t                  9/13/2014            CLOSED
C1000002    Migration-BLACKROCK AppV                                                           
2/11/2015    Terminated
C1000004    Migration-BLACKROCK AppV                                                          
10/24/2014    CLOSED
C1000005    Migration-BLACKROCK AppV        t                                  t  
              1/12/2015    On-Hold
C1000006    Migration-BLACKROCK AppV                                                  
         11/5/2014    CLOSED
C1000007    Migration-BLACKROCK AppV    t                                       
t               9/12/2014    CLOSED
C1000008    Migration-BLACKROCK AppV                                                              
8/6/2014    On-Hold
C1000009    BLACKROCK                                                                                      
8/5/2014    In Progress
C1000010    Migration-BLACKROCK AppV    t                                          t  
              8/5/2014    On-Hold
C1000011    Migration-BLACKROCK AppV                                                              
10/25/2014    CLOSED
C1000012    BLACKROCK                                                                                        
9/24/2014    CLOSED
C1000013    BLACKROCK                                                                                      
10/16/2014    Terminated
C1000015    BLACKROCK                                                                                        
9/1/2014    In Progress

Hi Imke,
I have achieved what i wanted to... I did try the way you have suggested. But end result was not fruitful.
I did following for status wise count.
Step1: In power query I have created duplicate status column for each status available.( Example I have status {closed,open,initial... etc} I have created duplicate column for each status and replaced with null.For closed Except closed all i replaced in
column with null).
Step2: So every time my power query data refreshes it does that step each time so that i can get the count of each status column wise in my pivot table.
I have attached the result,
Harsha

Similar Messages

  • How to create custom folder for parameterized query

    Hi Gurus,
    I developed a query to generate report to " who is reporting to who in organization", when i am trying to create custom folder using this query but i am getting error like "The custom sql entered contains parameter and therefore invalid". Could you please help to parameterize the emp_key in query in Oracle Discoverer. Is there any way to pass the value using external procedure for this query.
    SELECT
    lpad(' ', 8 *(LEVEL -1)) || emp_last_name, emp_key, manager_id, emp_key, manager_key,
    mgr_last_name, mgr_first_name, empid,
    emp_last_name, emp_first_name, LEVEL FROM cmp_ppl1 START WITH emp_key = &emp_key
    CONNECT BY PRIOR emp_key = manager_key;
    Thanks & Regards
    Vikram

    I agree 100% that it's way easier to create a dataview or a custom folder - with no run time parameters being passed to the EUL - as is being done by Vikram.
    The only concern I would have is that I don't know if it would work - or at least ever come back in reasonable time - for Vikram and therefore the question about parameters (only Vikram can say).
    The reason I'm wondering is that I've created SQL similar to being shown (when used in an org chart report at a large client) and the start / connect by is used for going down the tree getting everyone on the way. And if it's not limited - that could be a huge undertaking - of records and/or time. Guess it depends on how many people work at the organization (and of course, levels).
    But otherwise, absolutely, I would try and bring back all logical records to the folder and then filter in Disco.
    Russ

  • Creating Custom Theme for Power View Clustered columns chart

    Helllo...
    Is it possible to create custom theme for displaying clustered columns chart on Power View?
    Basically I am looking to create chart with specific colors for the bars? For e.g. for High - RED, Medium - Orange and Low - Yellow color. When I look at themes available in Excel 2013 I don't see this combination as such, so I was looking to create one
    myself. 
    I tried to create a theme using video on youtube, but the theme which I created is not showing up in Power View mode in excel 2013.
    www.youtube.com/watch?v=xs2F1n2-YR8

    Hi Sagar,
    In Power View, it has several default theme colors for us to apply to our workbook. Also, we can change the Font, Text Size and Background of the chart. However, it is not support to design a custom theme color.
    You can refer to the following steps to change the theme colors:
    1. On the POWER VIEW tab, in the Themes group, click Themes.
    2. Under Built-in, click the theme that you want to use.
    Please refer to the following screenshot below:
    Regards,
    Alisa Tang
    If you have any feedback on our support, please click
    here.
    Alisa Tang
    TechNet Community Support

  • How do I Send in a value to the SQL Query Expression's variable created using Declare in Power Query

    I have gone through the other posts where in a parameter is sent to query created by power query but my ask is a bit different. 
    I am using a sql query to retrieve data using Power query which has 2 variables declared in the DECLARE section in the query. 
    Ex: 
    declare @Name varchar(1000)
    SET @Name= 'Alpha'
    declare @location nvarchar(1000)
    SET @location= 'Bravo'
    Select * from Infotable where Name = @Name and location = @location. 
    Now in the following query I would want to send in the values for  the declared variables using a table in my worksheet. I have followed the stuff present in the following post 
    http://blog.oraylis.de/2013/05/using-dynamic-parameter-values-in-power-query-queries/
    but when using the value name (let Name_parameter = Excel.Currentworkbook(), Name_Value = Name_Parameter [0][value]) in the Advance Editor as mentioned in the above post I am being thrown an error stating  Name_Value column doesn't exist.
    I am having a tough time figuring out what the problem could be..

    I have gone through the other posts where in a parameter is sent to query created by power query but my ask is a bit different. 
    I am using a sql query to retrieve data using Power query which has 2 variables declared in the DECLARE section in the query. 
    Ex: 
    declare @Name varchar(1000)
    SET @Name= 'Alpha'
    declare @location nvarchar(1000)
    SET @location= 'Bravo'
    Select * from Infotable where Name = @Name and location = @location. 
    Now in the following query I would want to send in the values for  the declared variables using a table in my worksheet. I have followed the stuff present in the following post 
    http://blog.oraylis.de/2013/05/using-dynamic-parameter-values-in-power-query-queries/
    but when using the value name (let Name_parameter = Excel.Currentworkbook(), Name_Value = Name_Parameter [0][value]) in the Advance Editor as mentioned in the above post I am being thrown an error stating  Name_Value column doesn't exist.
    I am having a tough time figuring out what the problem could be..

  • New custom column in a query

    Hi experts,
    I am doing a query and I need to do something that I am not sure if it can be done. I have one characteristic (0COUNTRY) in the query and one variable to filter by Sales Organization. What I need to do is to have a new column in the query that will show ‘Local market’ in case 0COUNTRY is the same as the Sales Organization country attribute, and ‘Export market’ when it is different. Does anybody know if this can be done in BeX analyzer?
    Any hint would be appreciated.
    Thanks and regards,

    Hi,
    U can achieve this by using virtual characterstics.Add another characterstics in the cube with length 20 char (Say ZTEXT).
    Code in the exit RSR00002 with program ZXRSRU02 for virtual characterstics.
    Here u can put the logic as follows:
    Read value 0COUNTRY compare the value with SALESORG 0country attrtibute value  from master data table.
    if same ZTEXT = 'Local market’
    else.
               ZTEXT = 'Export market’
    There will be some performance issue but if the requirement like this u can try with this.
    Thanks,
    Debasish

  • Creating custom Column in IDT 4.1

    Hi All,
    I am using SAP IDT 4.1 SP03 to build a business layer over a SQL Server database using relational connection.
    I having a single table named CUSTOMER and it contains Customer ID, Customer Name,  City, SubscribeForEmail and date column. I want to filter the data on specific date range to view the data on below format:
    City
    Total Customers
    Customers subscribed for email only
    I have created the measure in business layer and filter customer count based on subscribeforemail flag. But IDT is showing invalid data. For ex:
    Database Table:
    Customer ID
    Customer Name
    City
    SubscribeForEmail
    Date
    1
    Customer 1
    City1
    Y
    1/1/2014
    2
    Customer 2
    City2
    Y
    1/1/2014
    3
    Customer 3
    City1
    Y
    1/1/2014
    4
    Customer 4
    City1
    N
    1/1/20014
    Data returned By IDT:
    City
    Total Customers
    Email Only
    City1
    2
    2
    Kindly guide.

    Hi Sreenivasulu,
    I have created two measures in business layer based on below format:
    Measure1: Total Customers = Count(DISTINCT Customer_ID)
    Measure2:  Email Customers = Count(DISTINCT Customer_ID)
                                                       Where SubscribeForEmail = 'Y'
    The query generated is:
    SELECT
         Table_3."City",
         count( Distinct (Table_3."Customer_ID")),
         count( Distinct ( Table_3."Customer_ID"))
    FROM "Customer" Table_3
    WHERE
    (Table_3."SubscribeForEmail" = 'Y')
    GROUP BY 1
    ORDER BY 1
    Here, the issue is WHERE clause is applied on BOTH columns whereas I want to apply it on one only.
    Regards,
    Hasan Arif Khan.

  • Custom column in Crosstab query in BO 6.5

    Hello Gurus,
    I am trying to create a report in BO 6.5 using data from two flat files by linking them and I applied cross-tab template as I need row data as columns based on a field called STATUS (Approved, Cancelled, In process etc). And in this STATUS field I want to add another column (Not Ordered) on the run using some conditions which is not in the flatfile. How can I do that?
    Please let me know if my post in unclear so that I can provide more data regarding the report.
    Thanks in advance for your time.

    Let me elaborate my requirement. I am trying to create a report using data from two flat files. I am supposed to give the status of orders. So I created crosstab query and I chose STATUS field data to be as columns. Currently it have three fields----Approved, In process, Waiting for approval. Now as per requirement I am supposed to include another column called Not applicable based on two fields Amount and Local/No local. Before this we used to create the same report uising excel and I used below formula:
    =IF(AND(Amount=0,B2="Non-Local"),"Not Applicable","Approved")
    But in BO if the above condition is False I want that particular record to fall under already existing "Approved" but it is creating another "Approved" status and it is not catagorizing Not applicable....I mean every record with amount =0 falls under new Approved status but not in Not applicable as expected. Hope you understand my issue.
    Am i doing anything wrong in creating formula?

  • Create Date Column out of Full Month Name and Year

    I am trying to use Power Query to create a new column of data as a Date.  My data contains two columns: Month as the full text name and Year, for purposes of this example, I will set all days to the 15th.  In Excel, I would simply use a formula
    to convert the text month to the proper date part.
    Example:  [Month] = "January" and [Year] = 2013
    DATEVALUE([Month]&" 15, "&[Year])
    What is the syntax to Add a Column in Power Query with this conversion? 
    Thanks, Barbara

    For an existing table in the editor with columns Month and Year, click "Insert Custom Column" and use this as the formula:
    = Date.FromText([Month] & " 15," & Number.ToText([Year]))
    This will create a formula which looks something like this:
        InsertedCustom = Table.AddColumn(Source, "Custom", each Date.FromText([Month] & " 15," & Number.ToText([Year])))
    Note that one difference between Excel and Power Query is that Excel will let you concatenate text and numbers with "&" but Power Query requires that you first convert the number to text.

  • How to create custom cloumns in report

    Hi,
    I want to create custom columns in the reports(columns which are not present in active subject area. Please help.
    Thanks
    Arpita

    Arpita,
    You can create a calculated column using any Field (Presentation Column) in any Presentaion Table.
    Eg: You want to calculate the difference between the Start and End Date of an Activity.
    1. Simply Create a report on the Activities SA (Analytics or Real-time doe not matter here)
    2. Add the required Coumns
    3. To calculate the difference between the Start and End time.
    - add the below fields from Activity
    - Click the 'Fx' icon any field that you would like to display the calculated value in.
    - Replace the existing formula in this field with TIMESTAMPDIFF(SQL_TSI_DAY, Activity."Created Date", Activity."Completed Date") - This is your calculated value
    Activity ID     Subject     Created Date     Completed Date     Difference
    AXXX-IHJ1W     Prepare Proposal     10/31/2011 6:39:43 AM     11/18/2011 4:48:54 AM     18
    For more details, I would suggest you look at the CRM On Demand Bookshelf or click the hlp link in CRM On Demand.
    Hope this helps!
    Thanks,
    Royston

  • How to create dynamics columns in oracle query1.

    hi,
    how to create dynamics columns in oracle query.its very urgent.
    regards
    prasad..

    Urgent is it?
    Why? Have you forgotten to do your coursework and you'll get thrown off your course if you don't hand it in today?
    What makes you believe that your request for help is more important than someone else who has requested help? It's very rude to assume you are more important than somebody else, and I'm sure they would like an answer to their issue as soon as they can get one too, but they've generally been polite and not demanded that it is urgent.
    Also, you assume that people giving answers are all sitting here just waiting to answer your question for you. That's not so. We're all volunteers with our own jobs to do. How dare you presume to demand our attention with urgency.
    If you want help and you want it answering quickly you simply just put your issue forward and provide as much valuable information as possible.
    Looking at your post you haven't told us what database version you are using, you haven't provided any create table DDL's and insert statements to populate that with sample data, and you haven't even shown us that you've had a go at doing something yourself.
    You will find if you post on here demanding your post is urgent then most people will just ignore it, some will tell you to get lost, and some will explain to you why you shouldn't post "urgent" requests. Occasionally you may find somebody who's got nothing better to do who will actually provide you with an answer, but you really are limiting your options by not asking properly.
    /rant
    As a basic example of dyanamic SQL:
    DECLARE
      cur PLS_INTEGER := DBMS_SQL.OPEN_CURSOR;
      cols DBMS_SQL.DESC_TAB;
      ncols PLS_INTEGER;
    BEGIN
      -- Parse the query.
      DBMS_SQL.PARSE(cur, 'SELECT hiredate, sal FROM emp', DBMS_SQL.NATIVE);
      -- Retrieve column information
      DBMS_SQL.DESCRIBE_COLUMNS (cur, ncols, cols);
      -- Display each of the column names
      FOR colind IN 1 .. ncols
      LOOP
        DBMS_OUTPUT.PUT_LINE (cols.col_name);
      END LOOP;
      DBMS_SQL.CLOSE_CURSOR (cur);
    END;
    /

  • When i attach workflow to document library, the custom columns data is not saving.

    Hi, i had created SharePoint designer workflow (send Email) for Document Library.
    I had created Custom columns like.
    "Employee Name" of type Person or Group  
    "Resume Type"  of type Choice 
    When i attach my workflow to document library, the columns data is not saved.
    It is just uploading resume, and sends email to the user groups, but data is not saved for custom columns. !.e "Employee Name" and "Resume Type".
    Any help will be appreciated.

    In SharePoint Document Library, first the document will be uploaded and then the metadata will be updated. So, in your workflow settings, select start workflow when item is changed instead of item is created and then try. 

  • New SP Custom List results in Power Query Error: Expression.Error: The key did not match any rows in the table.

    Hi,
    I'm running into something that seems to be a bug in Power Query. I've got my Power Query tables from SharePoint lists into Excel and Power Pivot data model. (Making sure the SharePoint site is in English and I replace MMD columns with normal columns). 
    But then, when I close down Excel, add another custom list to SharePoint, open the Excel workbook and want to add that new custom list using the same connection (via recent data sources).
    It shows the newly added custom list in the explorer but with an error:
    Nothing I can do to fix this; restarting Excel or PC; nothing. 
    The only way I got around this was by removing all my existing data sources and re-create them.. 
    after that, the same SharePoint custom list WAS read with Power Query without an issue.
    Thanks,
    Jeroen

    Its because of recent updates to Power Query.
    In recent updates internally their is some change in syntax for reading particular table from list (I faced this issue while reading data from Excel file, i.e After applying recent update of Power Query my Queries which were working fine before starting
    throwing same error that yo are facing).
    As solution their is small tweak to be done in existing queries, instead of recreating all queries. If you can provide me your complete old query from Advanced editor then I can point to tweak that need to be done.
    Thanks,
    Sagar K

  • Getting the same day of the week from a previous year in a Power Query calc column

    Hi Power Query users,
    Would like to get your suggestions on this problem. I have a customer that wants to see the previous year's sales for the same day of the week. So today is Friday July 25, 2014. Customer would like to see sales for the closest Friday on the previous year,
    which was Friday July 26, 2013. Next year on Friday July 26, 2015, customer would see the sales for Friday July 25, 2014 and so on. Customer operates 7 days a week, all days of the year including holidays.
    What is the most elegant way to do this? I am assuming the best thing to do is to add this date as a calculated column in the date table, but I am not quite sure the best way to write the formula (including handling of edge cases - leap years, providing
    null when the previous year is not part of the date table, etc).
    I am starting with the
    date dimension as presented by Matt Masson.
    Please help if you have any formula suggestions for this.
    Thanks

    Okay, I'm making a couple of assumptions, so please let me know if these assumptions are incorrect:
    1) Instead of all sales data being in a single column, current year and last year sales are provided in different columns,
    2) The previous year sales column shows the sales occurring on the same
    date as the current year sales (so in your example, 43214 is the sales figure for 6/1/2013.
    If the above assumptions are true, we need to modify how the lookup is done. Let's assume that you created a custom column named SameDayOfWeekLastYear. Create another column called Previous Year Date, using the following function (Date_PreviousYear)
    (date) =>
    let   
        PreviousYearDate = Date.AddYears(date,-1),
        PreviousYearDateAdjusted = if (Date.Day(date)=29 and Date.Month(date) = 2) then
                                       #date(9999,1,1)
                                   else PreviousYearDate
    in
        PreviousYearDateAdjusted
    Incidentally, I created this function the week before your query, for a different purpose. In that case, it was to get the previous year sales occurring on the same
    date as the current year sales. It actually gets to your starting point, but with all the sales data in a single column to start with. However, when the current year is a leap year and you apply the Date.AddYears function, February 29th is calculated
    as February 28th of the previous year. If you then do a lookup for previous year sales, you get February 28th sales looked-up twice (the real Feb 28th and the bogus one resulting from taking February 29th back one year). The PreviousYearDateAdjusted identifier
    puts a truly bogus date instead of a duplicated Feb 28th - one that will always return null when looking up the sales value.
    This new date column will then be used to lookup the row of the previous year sales column that corresponds to the dates in the SameDayOfWeekLastYear column.
    Assuming that the last step in your query is InsertedCustom1, create another custom column (Previous Year Net_Same Day?), which returns the sales on the same day as the current year (the result that you're after). The formula would be:
    LookupValue(InsertedCustom1[Previous Year Net], InsertedCustom1[Previous Year Date], [SameDayOfWeekLastYear])
    where LookupValue is the custom function mentioned previously. After creating this new custom column, you can then remove all of the columns you don't need.
    Hope that the preceding is somewhat clear.

  • How can I create dynamic file references in Power Query?

    Hi all,
    I'm new at using PowerQuery, and so far I like it. There's one thing I am struggling with though... Once I have set up my PoweQuery connections, I don't find an easy way to change the file to which the query is connecting. I'm using it for a monthyl recurring
    process, and every month the source data to query on woudl be different. The same in format/structure, but just a different dataset.
    Is there a way to make the source setup more dynamic? Can I for example in a parameters sheet enter the name and path of the new source file and update the queries?
    Currently the Advanced editor shows me following file reference:
    let
        Source = Excel.Workbook(File.Contents("Z:\Templates\EMEA\Source Data Tables\EMEA_EW_Source_Data_for_Power_Queries v1.xlsm")),
    Thanks in advance for suggestions

    Yes, this is something that you can do with Power Query. Here's how you can do it:
    Create a table in Excel containing your parameter value. Let's say that it has one column, called ParameterValue, and one row.
    Create a new Power Query query that gets the data from this table. Call the query something like ParameterQuery.
    In your original query you will now be able to reference values from your parameter query by saying something like this:
    Source = Excel.Workbook(File.Contents(ParameterQuery[ParameterValue]{0})),
    HTH,
    Chris
    Check out my MS BI blog I also do
    SSAS, PowerPivot, MDX and DAX consultancy
    and run public SQL Server and BI training courses in the UK

  • How to create custom BOL object for dynamic query in CRM 7.0

    Hi,
    Could anyone please explain me with steps that how to create the custom BOL object for dynamic query in CRM 7.0, I did it in previous version but its throwing exception when i try to create the object of my dynamic query class. I just defined the entry of my in crmv_obj_btil to create the dynamic query BOL object. do i need to do any other thing also to make it work?
    Regards,
    Kamesh Bathla
    Edited by: Kamesh Bathla on Jul 6, 2009 5:12 PM

    Hi Justin,
    First of thanks for your reply, and coming to my requirement, I need to report the list of items which are there in the dynamic select statement what am getting from the DB. The select statement number of columns may vary in my example for different countries the select item columns count is different. For US its '15', for UK it may be 10 ...like so, and some of the column value might be a combination or calculation part of other table columns (The select query contains more than one table in the from clause).
    In order to execute the dynamic select statement and return the result i choose to write a function which will parse the cursor for dynamic query and then iterate the values and construct a Type Object and append it to the pipe row.
    Am relatively very new for these sort of things, welcome in case of any suggestions to make it simple (Instead of the function what i thought to work with) also a sample narrating the new procedure will be appreciated.
    Thanks in Advance,
    mallikj2.

Maybe you are looking for

  • ABAP function call through vba

    Hi I am a vba/ .net developer. An ABAP programmer created an ABAP function and I´d like to call it through VBA code. To access it in SAP GUI, the user access the transaction /N/TENR/MM0035 However, when I access it in a VBA code I get an error Set oC

  • How do you open .bin files?

    I'm having trouble opening .bin files. It tries to open using StuffIt expander, but no dice. .dmg files are no problem. Anyone got any ideas?

  • BROWSER BACK BUTTON TO WORK!

    I went through this tutorial at: http://www.actionscript.org/resources/articles/142/1/Enabling-a-back-button-within-flash/P age1.html in order to get this highly discussed issue in Flash based sites sorted. However, it seems to "a bit" complicated an

  • CS5 Going Slow After Installing Acrobat 9 Trial

    I've had CS5 for a good while now (since it was released to FedEx Office emplyees a while back) and before that CS4. Inbetween there was a full reformat of my PC and reinstilation of Windows 7. Up until I installed Acrobat 9 and restarted my PC, ever

  • HT1689 error 42408 how can i correct it

    How can I correct the error code 42408