How to make a column based on another specific column's values? - cognos

Hello I am trying to make a report where I have something like
+--------------+---------------+----------------------+-------------+
| Employee ID | Employee Name | Manager Employee ID | Manger Name |
+--------------+---------------+----------------------+-------------+
| E001 | Bob Jones | E005 | Liz Bates |
| E002 | John Smith | E005 | Liz Bates |
| E003 | Jane Adams | E005 | Liz Bates |
| E004 | Al Doe | E005 | Liz Bates |
| E005 | Liz Bates | E006 | Jake Mann |
+--------------+---------------+----------------------+-------------+
I have the data items for "Employee ID", "Employee Name", and "Manager Employee ID". but there is no specific item for "Manager Name". How do i create a data item for "Manager Name" based on "Employee Name" for the given "Manager Employee ID". When I drag in "Employee Name" again to the right of "Manager Employee ID" it just gives me the employee based on the "Employee ID" and not "Manager Employee ID".
I have this question and answer multiple times on this site but they all are for SQL, which I don't know anything about.
SQL query to get the employee name and their manager name from the same table
Self Join to get employee manager name
How to get the employees with their managers
etc.

Master detail relationship could be an option as a workaround
Make a second list of employee ID and employee name
Take that second list and move it into the main list on the last column where manager name should be (It should look like a list within a list)
Click on that second list, look for the property master detail relationship. Click the ellipsis, link the employee manager ID from the main list to the employee id on the second list
Set the property for box type to none to hide the column for employee ID on the second list

Related

Excel search upwards from cell for first result meeting a criteria

Alright I have a bit of a weird problem:
I have a store, that sells Cookies, Cakes and Wine.
I also have a report on excel for what products were sold in a day. Looks something like this:
| ID | Product Name | Quantity Sold |
| --- |--- | --- |
| Cookies| | |
| 1 |Ginderbread | 2 |
| 2 |Chocolate chip| 5 |
| 3 |Cookie type C | 1|
| Cakes | | |
From this report my goal is to get a table looking like this:
| ID | Name | Quantity Sold | Category |
| --- |--- | --- | --- |
All I need to do is get the Category from above the records, to inside the records.
However, there's 1 restriction: I can't manually enter the Category. I must use some formula to find out what the category is.
1 idea I have thought of is to use a VLookup with the range being from the first row to the current row. But having trouble figuring out making it search for "Cookies", "Cakes" and "Wine" all at once then returning whichever it finds first (from bottom up)
Should be noted neither Product Name or ID are unique keys. Yes, I hate it as much as you do.
Assuming all your ID's are unique:
For the ID column:
=FILTER(A:A,ISNUMBER(A:A))
For the Name column:
=VLOOKUP(E2,$A:$S,2) (and fill down)
For the Category Column:
=LET(x,FILTER($A$1:INDEX($A:$A,MATCH(E2,$A:$A,0)),$A$2:INDEX($A:$A,1+MATCH(E2,$A:$A,0))="ID"),y,COUNTA(x),INDEX(x,y))
(and fill down)
To return the category
MATCH the Id number to get the last row number to check in the first column
Create a filter that only returns the row which says ID
Use that filter criteria against a range that is offset by one (up) which will return an array of just the categories
Return the last item in that array

Vlookup for row to column

My table is something like below, currently I have a column as category with few types of cat names but now we what to have the categories as column header and the name's attached to it.
Table now;
ID | category | Name |
856| Car | Ford |
432| Motorcycle | Honda|
Desired;
ID| Car | Motorcycle |
856| Ford | (blank) |
432 | (blank) |Honda |
How can I do this?
Say your "Table now" table is named TableNow, and your "Desired" table is named TableDesired. Put this formula into your Car column, and fill over.
=IF(VLOOKUP([#ID],TableNow,2,FALSE)=TableDesired[#Headers],VLOOKUP([#ID],TableNow,3,FALSE),"")

Filter data when parameter is not null

I have a list in a Report, such list is based in a query that show something like this:
+------------+----------+------------+
| Employee | City | Client |
+------------+----------+------------+
| Alex | All City | All Client |
| Alex | Chicago | Google |
| Alex | NY | Twitter |
The Employee can have many cities and many clients, the list is dynamically refresh by prompts and its parameter value come from a Drill-Throught in a dashboard.
So, I need to show in my list just the different city and the different clients, excluding the "All" data, but if the parameter is null should not exclude the "All" data, because City and Client came from a hierarchy and if the "All" is excluded will be no data in my list.
If parameter is not null, my list should look like this:
+------------+---------+---------+
| Employee | City | Client |
+------------+---------+---------+
| Alex | Chicago | Google |
| Alex | NY | Twitter |
+------------+---------+---------+
But if is null, should look like this:
+------------+----------+------------+
| Employee | City | Client |
+------------+----------+------------+
| Alex | All City | All Client |
+------------+----------+------------+
Have you tried something like this:
(?param? is null AND [City] = 'All City' AND [Client] = 'All Client')
OR
(?param? is not null AND [City] <> 'All City' AND [Client] <> 'All Client')
I think you are using DMR or a cube?
Make 2 hierarchies
For the second hierarchy, set Multiple root members to True - the hierarchy contains multiple root members. Selecting this option deletes the All level that is automatically created at the top of the hierarchy.
see https://www.ibm.com/support/knowledgecenter/en/SSEP7J_11.1.0/com.ibm.swg.ba.cognos.ug_cog_rlp.doc/c_cog_rlp_dsgn_hier.html
Make a variable to determine if the parameter is null
Make two lists
List1 will include all cities -- have a hierarchy that includes ALL
List2 will exclude all cities -- have a hierarchy without ALL
Render List1 when the parameter is null
Render List2 when the parameter is NOT null

Excel: Determine if value exists in third column of pivot table, based on 2 preceding columns

I have a list of user's attributes nearly 10,000 long. Each user has multiple attributes, based on their department and job code. Looks a little something like this:
| USER | DEPT | JOB | ATTRIBUTE |
| User A | Dept 1 | Job 1 | Attribute 2 |
| User A | Dept 1 | Job 1 | Attribute 3 |
| User B | Dept 2 | Job 1 | Attribute 1 |
| User B | Dept 2 | Job 1 | Attribute 2 |
| User C | Dept 1 | Job 2 | Attribute 3 |
| User C | Dept 1 | Job 2 | Attribute 4 |
| User C | Dept 1 | Job 2 | Attribute 5 |
| User C | Dept 1 | Job 2 | Attribute 6 |
Where "Job 1" can have different attributes based on which department job 1 is in. I also have a pivot table in a different workbook that defines which attributes a job code should have for each department. I need a formula that will take the attribute in the row, and compare it to the pivot table to see if that attribute is associate with that department and job code combination.
EDIT
I am no longer using a pivot table, and have taken all information from the pivot table and populated the worksheet (so there is a data entry for every column in the row.
I have taken the suggested formula and updated to reflect my page titles, however I only receive back "Not associated for everything.
=IFERROR(INDEX('Roles'!C:C,MATCH(B2&C2&D2,'Roles'!A:A&'Roles'!B:B&'Roles'!C:C,0)),"Not Associated")
If I understand correctly, this is checking to confirm there is a match of B2 in column A of Roles, a match of C2 in column B of Roles and a match of D2 in Column c of Roles. If that is correct, there is a match for each, but am still returning Not Associated.
Assuming your pivot table is Worksheet PivotTable starting in column A with the following fields
Dept | Job | Attribute
and your referenced data is in columns A:D of the current sheet use this formula:
=IfError(Index(PivotTable!C:C,Match(A2&B2&C2,PivotTable!A:A&PivotTable!B:B&PivotTable!C:C,0),"Not Associated")
This will return "Not Associated" if the attribute is not associated witht the Dept and Job, or will return the attribute if it is associated.

Excel find if user paid monthly invoice

I have two worksheets
Worksheet1 looks like:
Customer | June | July | August
John | | |
Jane | | |
Bob | | |
Ann | | |
Worksheet2 looks like:
Customer | Paid Amount | Month
John | $50 | June
Jane | $20 | June
Bob | $100 | June
Ann | $10 | June
John | $30 | July
Jane | $40 | July
Ann | $5 | July
Bob | $10 | August
John | $10 | August
Jane | $20 | August
In Worksheet1 I need a formula that simply returns a string, like "Paid" or "Not Paid", by taking the Customer name from Worksheet1, doing a lookup on Worksheet2 for that customer name, and checking if there is a payment record for that month. Based on the example data above, the result in Worksheet1 should look like:
Customer | June | July | August
John | Paid | Paid | Paid
Jane | Paid | Paid | Paid
Bob | Paid | Not Paid | Paid
Ann | Paid | Paid | Not Paid
I tried the following:
IF(ISNA(VLOOKUP([#Customer],table_from_Worksheet2,2,FALSE)),"No","Yes")
Problem is that's checking the entire Worksheet2 and not filtering by the month in question. I need to somehow tweak the VLOOKUP (or use another method such as INDEX and MATCH but I don't know how to use them) to find if customer made a payment for that specific month.
Consider using a pivot table with "month" in the column labels box, "Name" in the row labels box, and "count of paid amount" in the values box.
Select your whole table on sheet 2.
Select Insert-->PivotTable (Far left of the ribbon)
Drag and drop the categories as I described above.
This will give you a 1 in every month/name combination where a customer has paid, and a blank otherwise. Now select the interior of your Pivot Table, Right Click and "Change Format" Select Custom Format, and scroll down to the Type called "TRUE";"TRUE";"FALSE" and apply.
Right Click on the "Grand Total" and "Remove Grand Total" if you so desire.
Pivot tables are scary at first, but very powerful and worth learning.
(I added another person before I made the table below)
Place the formula in B2 on worksheet1 (Where John and June meet) and copy across and down. Be sure to enter the formula with CTRL + SHIFT + ENTER:
=IFERROR(IF(INDEX(Worksheet2!$B$2:$B$12,MATCH($A2,IF(B$1=Worksheet2!$C$2:$C$12,Worksheet2!$A$2:$A$12),0)),"Paid","Not Paid"),"Not Paid")
For a table you can use:
=IFERROR(IF(INDEX(Table_from_Worksheet2[Paid Amount],MATCH([#Customer],IF(B$1=Table_from_Worksheet2[Month],Table_from_Worksheet2[Customer]),0)),"Paid","Not Paid"),"Not Paid")
You will also need to enter with CTRL + SHIFT + ENTER
Please note, you are going to need to adjust the ranges as neccessary.

Resources