Why can't I draw a line chart with my data? - tableau-desktop

I try to write a simple function to calculate my data, but I do not know how to draw the chart with it.
My first question is I don't want the col. customer_unique_id left on the sheet, but if I remove it the whole data would disappear.
The second question is that I can not count the total of each type, which I hope I could present on my chart. I want to present it in a line chart.
This is my screenshot.
These are some functions I write.
[count_duplicate]:IF COUNT([Order Id])>1 THEN "DUPLICATE" ELSE "X" END
[IF_IN_1_YEAR]:IF MAX([Order Purchase Timestamp])>DATE("2017/12/31") THEN "POTENTIAL"
ELSE "X" END
[CUSTOMER_TYPE]:IF [Count_duplicate]="DUPLICATE" and [IF_IN_1_YEAR]="POTENTIAL" THEN "LOYAL"
ELSEIF [Count_duplicate]="X" and [IF_IN_1_YEAR]="POTENTIAL" THEN "COULD BE LOYAL"
ELSEIF [Count_duplicate]="DUPLICATE" AND [IF_IN_1_YEAR]="X" THEN "OLD CUSTOMERS"
ELSE "ONE-TIME USER" END
This is how my raw data looks like:

Related

How to automatically get hyperlinks based on a condition?

OS: Windows 10
Here's the basic idea:
I have a list of foods that are on the left side, and when I decide which foods I want, I then decide what order I want them in. After they are in the right order, G7-J7 (Linked Foods) should automatically place a hyperlink based on what food I selected in the Order of Food. How it pulls these links should be from the List of Foods. Then, at the bottom, there are 4 images that will automatically be shown based on what link is in the Linked Food boxes.
Basically, what I did, was I made the Linked Food 1 formula =IF(G3 = "Ramen", D2, "No Link Found").
And then for the Food 1 image, I did =iferror(arrayformula(image(G7)),"")
The image should automatically be there for whatever link I put in the G7 box now, but the G7 box is the main issue I'm having.
Everything works, but this is only an example. In my REAL project I'm doing, I have tons and tons of "foods" and I can't just put =IF(G3 = "Ramen", "Lemonade", "Tofu", "Fruit Punch", ...and the hundreds of others.
SO...What I'm wondering, is if there's an easier way to make these links automatically change, without having to manually put every single item from the List of Foods into the formula.
Any help is appreciated!
It is somewhat unclear if the question is asking this for google docs or Excel, but the solution is basically the same either way.
What you want here is called "VLOOKUP". You will be replacing this line:
=IF(G3 = "Ramen", D2, "No Link Found")
with
=VLOOKUP(G3, C2:D8, 2, FALSE)
This will take the value of cell G3 (Ramen in the example case) and search the range of C2:D8 (all the cells on the left of your table) until it finds it. Once it does it will go to the second column of the range (C = 1, D = 2) and take the matching cell value. The FALSE at the end has to do with sorting but shouldn't play a role here.
Note that your range needs to be the entire size of your foods list so change that D8 to DX where X is the size of your list in rows.
You can read the full syntax for VLOOKUP at: https://support.google.com/docs/answer/3093318?hl=en

Google Sheets, need to edit a column based on two columns on a second sheet

Good morning!
I've been searching high and low for how to do this, and while I feel like I get close I can't get anything more than 'invalid formula' from the conditional formatting in google sheets. So here's what I'm trying to do;
Column C on sheet 1 (Working List) needs to have a red background if the following conditions are met;
Column 'P' on sheet 2 (Complete) has the 'Address Changed' option in the drop down box (its the first one on the drop down, I've been struggling to figure out if it needs to be a '0' given its position in the list or if its 'Address Changed')
Column 'C' on sheet 2 has the same account numbers in Column 'C' on sheet 1.
I can set it up to find duplicate accounts, but I can't seem to figure out how to get the first rule for the drop down box to work. Advice?
Attempts thus far, none of them worked, all were tried separately and not in conjunction with each other. Google just says 'invalid formula' and won't save it or do anything with it.
=and(EQ(Complete!$O, "Address Changed"), EQ('Working List'!$C, Complete!$C))
=match($C2, indirect("Complete!$C:$C"), 0)
=if(EQ, indirect("Complete!$O, "Address Changed""), EQ('Working List'!$C, "Completed!$C"))
=and(indirect("Complete!$O:$O,$O="Address Changed""))
so I've tried to figure out a better way to get it working, and this is what I think might be closer to the answer.
=and(if($O:$O,indirect("Complete!$O:$O),0)),[match($C2,indirect("Complete!$C:$C"),0)]
***Friend helped me solve this. The following worked for what I needed....
=index(indirect("Sheet2!O:O"), match(C1, indirect("Sheet2!C:C"), 0)) = "Address Changed"
Take a look at this sheet with some foo data I built based on your sheet.
https://docs.google.com/spreadsheets/d/1RcM5WX3KWgWq-WWuPgyF-PZe3RP99qWF-IRpSr35Zik/edit?usp=sharing
I used some helper column, as you see.
if sheet2!P1 is changed to "Address Changed" K1 will have value of 1. This is a simple IF function.
if sheet2!C = sheet1!C, L will change to 1. This is another simple ARRAYFORMULA(IF())
Finally, column C will be formatted with the data from K1 and L by this formula
: =AND(L2=1, $K$2=1)
You can then hide the helper column / cell.
If you don't want to use helper column, look at the formula in column D :
=AND(INDIRECT("Sheet2!C2:C") = C2:C, INDIRECT("Sheet2!P1")="Address Changed")
This will serve your purpose.
You cannot refer to another sheet directly in conditional format formula, hence if you don't want to use helper column, you will have to use INDIRECT. This is also the reason why your formula failed in the first place.
I personally wouldn't recommend you to use INDIRECT though...

I have text in B1:B15, if text in B17 = anything from B1:B15 return in C17 true otherwise false

I'm trying to write a string that can cover off all text in B1:B15 but get stuck when comes to adding beyond the first part which I can get to work.
I have this so far =IF((B17=B1),"North")
I then want to continue so covers off B1:B8 as North and B9:B15 as South based on selection made
Example
Your question title says you want to see 'True' or 'False' in C17 depending on whether or not the value in B17 is in the list B1:B15. Try this in C17:
=NOT(ISNA(VLOOKUP(B17,B1:B15,1,FALSE)))
If instead of just getting true/false you want to return the value in column C depending on which value was matched in column B then you would use:
=VLOOKUP(B17,B1:C15,2,FALSE)
I don't quite understand what you're asking because your example image has nothing in B17.I assume you're writing your equation in C1?
If I'm following what you're asking, what you actually probably want to do is, in C1:
=IFERROR(VLOOKUP(B17,$B$1:$C$15,2,0),"Not found")
Then fill that equation down as far as you need to go in column C. The iferror means if the vlookup fails to find something, it'll display that message, which you can make whatever.
I will follow your logic
=IF(COUNTIF(B1:B16,A17)>0,"True","false")
"If the number of coincidences of A17 in the range B1:B16 is bigger than 1 then 'True', else 'false'"

Call center Calculating monthly and annual percentage

I'm trying to put together management information for a call center.
I've got the following info on every call that gets logged:
[CreatedOn] = Date & time of creation
[Case_status_name] = Reason for closing the call (Answered by 1st line, transferred to 2nd, call back request etc.)
Now what I'm looking to make is a graph which will show in one line the % of calls that were answered by the 1st line and the annual average% of calls closed by the first line during the last 12 months.
I can get the months from [CreatedOn] with the extract function, the same goes for the year.
I can group the [Case_status_name] in 1st line answered and everything else with a simple if statement.
But I'm having trouble getting the percentages right for both the month and the year together.
I can get sensible data if I only calculate the yearly average or if I calcluate the monthly average. But when I try to do them together, I wind up getting all kinds of crazy values.
What is a proper way to get the monthly and annual percentage in the same table?
Create Query
Add Column [Month] with expression
_first_of_month([CreatedOn])
Add Query Item [Total] with expression
1
Add Query Item [Answered by 1st line] with expression
case when [Case_status_name] = 'Answered by 1st line' then 1 else 0 end
Add Query Item [closed by the first line] with expression
case when [Case_status_name] = 'closed by the first line' then 1 else 0 end
Filter this Query
[CreatedOn] between _first_of_month(_add_months(current_date;-12))
and _last_of_month(_add_months(current_date;-1))
Add Query Item [% of calls answered by the 1st line] with expression
[Answered by 1st line] / [Total]
Add Query Item [12-month average] with expression
sum([closed by the first line] for report) / sum([Total] for report)
Build Graph based on this Query

Tic Tac Toe (Lua (Touch Lua)) detecting 3 in a row?

So I think I have a great setup, each "Button" has a column and row. Here's my current function:
function CheckForWin()
local X = {}
local O = {}
for i,v in pairs(ClosedButtons) do
if v.title == "X" then
table.insert(X, v)
elseif v.title == "O" then
table.insert(O, v)
end
for i,v in pairs(X) do
--Find 3 Xs in a row
end
for i,v in pairs(O) do
--Find 3 Os in a row
end
end
end
My question, is how should I detect?
A 3 in the row would occur if 3 buttons had the same row or column right? But the diagonal one would be a special case, it would be if 3 buttons had the same row and column in them?
Should I keep a table to check and see how many buttons have a column of 1/2/3 and a table to check how many buttons have a row of 1/2/3, and a table to see how many have the same row/column? To me that seems incredibly inefficient.
Is there a better way I should know before I start using a bunch of tables?
EDIT: Just to be clear, the buttons are tables with the properties "column" and "row"
To do this you would have to keep track of every row and column tiles, check for 3 in a row directly. Although inefficient I do not see any other way.

Resources