Looker: Unable to show Subtotals when group in 2 levels - subtotal

So I have created 2 Custom Dimension to group our people with their designated Team and Managers.
First Dimension is for Teams, while 2nd one is Managers.
As I see the scorecard of our employee, I want to see also the Team Score, so by ticking the “Sub totals” do the job (see screenshot). Then I want to see also Managers scores, But after I added the 2nd dimension which is Managers it’s not showing any data.
This is the code for Teams dimension
if (matches_filter(${DA_name},`name1, name2, name3...`), "Team A",
if (matches_filter(${DA_name},`name10, name11, name12...`), "Team B", ...)
This is the code I use for Custom dimension of Managers
if ((${team_name} = "Team A"
OR ${team_name} = "Team B"
OR ${team_name} = "Team C"), "Manager A",
if ((${team_name} = "Team D"
OR ${team_name} = "Team E"
OR ${team_name} = "Team F", "Manager B", “”))

Related

Create a table in a new sheet with data from two different tables in two different sheets in excel

I am new to Excel and is currently struggling to get intermediate formulas right.
Here is what I'm trying to achieve.
A) I have three sheets,
EMPLOYEE, 2. PROJECTS and 3. ENGAGEMENT
B) EMPLOYEE sheet contains information about an employee. Employee ID (EMP_ID) is generated from the name entered.
C) PROJECTS sheet contains information about the projects handled or being handled. Project ID is generated from the name of the project. Most important part is the column "Resource 1" through "Resource 20" for now. As of now, a project can have maximum of 20 resources allocated to it. One can select resources from the drop-down list.
What I am trying to achieve is,
On "ENGAGEMENT" sheet, all the projects where a resource is engaged needs to appear under "Project 1" through "Project 10" columns (assuming that a person can work on maximum of 10 projects).
I need to show stats for projects between START and END date in ENGAGEMENT sheet. However, this is not of highest priority.
Please note that, I want to achieve this with formulae only, not script or macro.
Please look at the attached screenshots and the sheet I've attached.
Thanks,
Dave
Screenshots and references can be downloaded from below given links.
[1]: https://i.stack.imgur.com/kTcjW.jpg
[2]: https://i.stack.imgur.com/yLyZI.jpg
[3]: https://i.stack.imgur.com/WeoTj.jpg
[4]: https://i.stack.imgur.com/LgDiW.jpg
[5]: https://docs.google.com/spreadsheets/d/1qikvz4X6bvKO8PyB_nrmZA64x6StUMlh/edit?usp=sharing&ouid=109764009612506156621&rtpof=true&sd=true
=ARRAYFORMULA(IFERROR(SPLIT(IFNA(VLOOKUP(TRIM(A3:A),
SPLIT(SUBSTITUTE(TRIM(FLATTEN(QUERY(QUERY(SPLIT(FLATTEN(QUERY(FLATTEN(IF(DAYS(
IF((PROJECTS!D2:D4="")*(PROJECTS!C2:C4<>""), TODAY(), PROJECTS!D2:D4), PROJECTS!C2:C4)>
SEQUENCE(1, 1000, ), ROW(PROJECTS!A2:A4)&"×"&PROJECTS!C2:C4+SEQUENCE(1, 1000, )+1, )),
"where Col1 is not null")&"×"&TRANSPOSE(QUERY(FLATTEN(
IF(PROJECTS!I2:4="",,ROW(PROJECTS!A2:A4)&"×"&PROJECTS!I2:4&"×"&PROJECTS!A2:A4)),
"where Col1 is not null"))), "×"), "select max(Col5) where Col1=Col3 "&
IF(D1="",," and Col2>="&VALUE(D1))&
IF(F1="",," and Col2<="&VALUE(F1))&
" group by Col5 pivot Col4"),,9^9))), " ", "×", 1), "×"), 2, 0)), " ")))

SharePoint Calculated Column - Get Dynamic Column ID

I have a number column called "Team Leader", "Process Lead", "Regional Manager"
I will get Team Leader Name, if "Team Leader" Column is Blank, then Get the Name of "Process Lead", if Both Column is Blank then Get the Name of "Regional Manager"
I also have a calculated column that looks to this column.
=IF(ISBLANK([Team Leader]),"",[Team Leader]),=IF(ISBLANK(["Process Lead]),"",[Process Lead])
This is where I am with my formula which doesn't work. Has anyone achieved this?

Either of these 2 should help you:
First, result in blank value if Regional Manager is not provided.
IF(ISBLANK([Test column1]),IF(ISBLANK([Test Column2]),IF(ISBLANK([Test Column3]),"",[Test Column3]),[Test Column2]),[Test column1])
Another one:
IF(ISBLANK([Test column1]),IF(ISBLANK([Test Column2]),IF(ISBLANK([Test Column3]),"",[Test Column3]),[Test Column2]),[Test column1])

How to select multiple rows based on header values?

I wish to iterate over rows of a Pandas dataframe while only checking for similarity within a few columns among the rows. Then, I want to check for a similarity condition, followed by a date comparison (which one is earlier/later) and apply corresponding changes to one element of the row selected.
For selecting particular rows, I kind of want something like this:
p=z["product_name", "Category 1", "Category 2", "Features"].iloc[i-1:i]
I know it's not correct, but it's just to give an idea. Select a row with only a few particular headers out of many.
i=1
while (i<=len(z)):
j=i+1
p=z["product_name", "Category 1", "Category 2", "Features"].iloc[i-1:i]
p=p.to_string(index=False)
while(j<=len(z)):
q=z["product_name", "Category 1", "Category 2", "Features"].iloc[j-1:j]
q=q.to_string(index=False)
if (p==q):
if(z["Update Date"].iloc[i-1:i]>z["Update Date"].iloc[j-1:j]):
z.drop(j, axis=0)
j=j+1
i=i+1
I know that most of this code is actually wrong but this is the approach I'm trying. Please suggest a better approach/function that solves this problem.
I don't know your question exactly, But there are Basic Issue in your code when you start i-1:i, it gives only one value why you use this line instead of directly one variable
p=z["product_name", "Category 1", "Category 2", "Features"].iloc[i-1:i]
try This:
p=z[["product_name", "Category 1", "Category 2", "Features"]].iloc[i-1:i]

Power Query Change Text if it Contains a certain word or group of words

I have a query that pulls in the banking activity each month and compares it to the prior months' activity using a pivot table. This works well as long as the items are named consistently at the bank. There are a few items where each transaction is assigned a name and a new number each month and therefore can't be compared to the pivot table. The query pulls data from a CSV file and I'm looking at the "Description" column.
Examples where the data is included in each description and therefore a pivot table doesn't recognize these as similar items:
TRANSFER FROM ACCOUNT 1.010318
TRANSFER FROM ACCOUNT 1.010218
PRINCIPAL 4-401032018
PRINCIPAL 4-401022018
What I would like to do is modify my query so that it looks to the Description column for TRANSFER FROM ACCOUNT 1... and renames all items TRANSFER FROM ACCOUNT 1 and PRINCIPAL 4-... and renames these items to PRINCIPAL. I've tried using Transform > Replace Values and it produced this code, however, this does not work. Any suggestions on how to replace the values in the Description column if they contain a certain word or group of words?
#"Replaced Value" = Table.ReplaceValue(#"Filtered Rows1","PRINCIPAL 4-*","PRINCIAPL",Replacer.ReplaceText,{"Description"})
#"Replaced Value" = Table.ReplaceValue(#"Filtered Rows1","TRANSFER FROM ACCOUNT 1*","TRANSFER FROM ACCOUNT 1",Replacer.ReplaceText,{"Description"})
Try to do following:
Define a function (logic can be more complex)
fGetNewDescription = (Description as text) =>
let
#"Fist Part" = Text.Start( Description , 23 ),
#"Second Part" = Text.Range( Description , 31, 11 ),
#"New Description" = #"Fist Part" & " " & #"Second Part"
in
Call this function when add new column
= Table.AddColumn(#"Changed Type", "New Description", each
if Text.Contains( [Description],
"TRANSFER FROM ACCOUNT " ) and
Text.Contains( [Description],
"PRINCIPAL " )
then fGetNewDescription([Description])
else [Description] )
Or if you want to transform column in-place
= Table.TransformColumns( #"Changed Type", { {"Description",
each if Text.Contains( _, "TRANSFER FROM ACCOUNT " ) and
Text.Contains( _, "PRINCIPAL " )
then fGetNewDescription( _ )
else _, type text}})
Probably you have other descriptions, so I decided to add check if it contains both "TRANSFER FROM ACCOUNT " and "PRINCIPAL ".
I'm more of a UI guy, so I would use the Query Editor ribbon and go to Add Column / Conditional Column. In that dialog I would specify the series of rules to output what you want, along the lines of:
If [Description] contains TRANSFER FROM ACCOUNT 1 then PRINCIPAL
Else If [Description] contains PRINCIPAL 4- then PRINCIPAL
Else [Description]
This will produce an added column (it generates a Table.AddColumn), so I would then add Steps to remove the original [Description] column and rename the added column to suit.

Excel Error Handling - Lookup and Return Employee ID

Request:
Please assist w\ formula logic to provide error handling and Vlookup functionality across two possible columns (within table array) and return employee ID (third column in array).
Goal:
Create an auto-populating attendance tracker that looks up the inputted phone number and returns their employee ID on an embedded "Roster" worksheet. Also, I am trying to give functionality for vlooking up across two phone numbers.
"Attendance Tracker" worksheet Table Layout: (emphasis in italics)
DATE | TIME | CALLER ID | TYPE | REASON | DETAILS | EMPLOYEE # | ETC...
Caller ID = Column D
Employee # = Column I
"Roster" worksheet table-array for VLOOKUP
Column H = "Contact Primary"
Column I = "Contact Secondary"
Column J = "Employee Number"
Primary Formula(s)
"First"=VLOOKUP(D2,Roster!H:J,3,0) <--- Looks up emp number against "Contact Primary"
"Second"=VLOOKUP(D2,Roster!H:J,2,0) <--- Looks up emp number against "Contact Secondary"
My Attempt
=IF(D2="","",IF(ISERROR(IF(ISERROR(VLOOKUP(First)),VLOOKUP(Second),VLOOKUP(First))),"Add # to Roster",VLOOKUP(FIRST))))
MY RESULTS
"Caller ID" left blank - Perfect! Top level if-statement fixes blanks.
"Caller ID" exists in "Contact Primary" Column - Perfect! Value Returns.
"Caller ID" exists in "Contact Secondary" Column - Oh No! "Add # to Roster" returns.
"Caller ID" DOES NOT exist in either "Contact Primary/Secondary" - Oh No! "Add # to Roster" returns.
I hope I explained that well enough. And thank you so much in advance if you are able to assist!
I suspect what you want may be:
=IF(D2="","",IF(AND(ISERROR(VLOOKUP(D2,Roster!H:J,3,0)),ISERROR(VLOOKUP(D2,Roster!I:J,2,0))),"Add # to Roster", IF(ISERROR(VLOOKUP(D2,Roster!H:J,3,0)),(VLOOKUP(D2,Roster!I:J,2,0)),(VLOOKUP(D2,Roster!H:J,3,0)))))

Resources