can dialogflow look at google could database and answer selected questions? - machine-learning

I have got a question, i want this scenario with Google Dialogflow:
A) Hi how can i help you?
B) I want a m2 price of residentials at Istanbul, Beyoglu.
A) Okey i am looking ...
A) m2 price of a residential at Istanbul, Beyoglu is 20000 turkish liras.
-----or-----
A) Hi how can i help you?
B) can you tell me how many house has been sold in portgual last week?
A) Please wait i am getting these results ..
A) 2000 house have been sold in portgugal last week.
I want dialogflow to understand user input (intent) and look at the database (like convert user intent to sql query or sth like this) and answer the selected question.
Is there any chance to do it ?

Related

Cumulative count of working days with conditions (multiple employees) in Google Sheets

guys,
I have the following problem: I have the schedule of four employees and I need to count how many consecutive days they are working.
The file is in Google Sheets, here is the link, if someone wants to copy the data and try it: https://docs.google.com/spreadsheets/d/1TUJr9skcXQDtGEV36JVHMGgiLzPlCiEgaPqJ5ZazfFI/edit?usp=sharing
Here is the snip of the document:
In description, Col A, B and C are containing the date, name of the person and its schedule ("Off" for the days he\she doesn't work). This is the raw data.
Col D is converting to 0s if the person is Off and 1 if the person is working.
Col E is the column on which I can make changes, taking people off shift when they are scheduled and vice versa. (data validation column with 2 values).
Col F is converting to 0s if the person is Off and 1 if the person is working after my change.
In Col G I have used formula =IF(F2=0,0,SUMIFS(F$2:F,B$2:B,B2,A$2:A,"<="&A2)) to count the consecutive days, but unfortunately it counts all days with a casual zeros in between.
What I need is the numbers to restart after a zero (col H, I have filled it manually).
This is an example data with four employees, but my original data is with over 300.
I also am not very proficient in using scripts so I would really prefer to be a formula.
Any help would be highly appreciated!
P.S. If someone can suggest a better display of my data and how to achieve it I would be very grateful!
Another option with SUMPRODUCT:
=SUMPRODUCT((B2=$B$1:B2)*(ROW($B$1:B2)>IFERROR(LOOKUP(9^9,ROW($B$1:B2)/((B2=$B$1:B2)*(0=$F$1:F2))),1)))
This is just a pull-down formula: no auto-expanding formula so far I'm afraid:
=ArrayFormula(if(F2=0,0,
countifs(F$2:F2,1,B$2:B2,B2)-
countifs(F$1:F1,1,B$1:B1,B2,row(A$1:A1),"<"&iferror(vlookup(row(B2),if((B$1:B1=B2)*(F$1:F1=0),row(B$1:B1)),1),0))))
in (say) I2.
EDIT
This would have been a bit simpler:
=ArrayFormula(if(F2=0,0,
countifs(F$2:F2,1,B$2:B2,B2)-
countifs(F$1:F1,1,B$1:B1,B2,row(A$1:A1),"<"&max(if((B$1:B1=B2)*(F$1:F1=0),row(B$1:B1))))))

EXCEL VLOOKUP/MATCH/VARIABLE

Good Evening and thanks in advance for taking the time to read and help.
I have a 3 column excel file which I am trying to populate the 3rd column with a return value found next to the row its found in.
so for example I want to look at column MANAGERSFULLNAME for value
Cheryl Rommelfanger and find the match in column FULLNAME. Once the match is found I want to populate MANAGERSX2FULLNAME but not with the value found in FULLNAME but with the value next to in column MANAGERSFULLNAME
So for this example we look in MANAGERSFULLNAME for Cheryl Rommelfanger and find the match in FULLNAME Cheryl Rommelfanger then populate MANAGERSX2FULLNAME with
William Dearth
FULLNAME MANAGERSFULLNAME MANAGERSX2FULLNAME
Dena Peters Cheryl Rommelfanger
Kyle Marsh Melissa Hall
Cheryl Rommelfanger William Dearth
ive tried a few things and can only get a count not the value next to it.
=MATCH($E2&$F2,INDEX($B2:B4000&$C2:C4000,),)
=IF(ISERROR(MATCH(E2,F2,$B$2:B$4000,$C$2:C$4000,0)),"",E2)
=IF(ISERROR(MATCH(L2,$K$2:K$4000,0)),"",L20)
any help would be greatly appreciated.
So I apologize but I am having a bit of trouble understanding your columns, but the general idea is clear.
Your attempts are really close. You want to use index(match) as opposed to match(index). The link below describes how to do this.
Index match formula
If I'm understanding you correctly it sounds like you're trying to find and list the bosses boss so-to-speak to display a hierarchy of sorts. I'm using just columns A, B, and C (C being the managerx2fullname) this formula should work fine:
=index(B$2:B$4000,match(B2,A$2:A$4000,0))
You will of course need to change the columns to fit your needs. Don't include a dollar sign in B2 because you want this to increment as you drag the formula down the column. The link below shows a screen shot from my test. In it we see that in row 2 John is Adams boss, who in turn is Joe's boss. I think that's what you're shooting for here.
Screen shot

Summing query results based on another column in Google Spreadsheets

Hi I have this sample sheet: https://docs.google.com/spreadsheets/d/1TzKlEAF5IcZehmyyRUQ5ELE63Q-ZVfp9Nfx5-zvKAOc/edit?usp=sharing
I want to pull the data from the left chart. Then I want to sum Same companies revenues. Then I want to put that data dynamically to the right part. I also want to be able to check how much revenue I got from each company each month. I also want to see top 5 companies who made purchase in each month.
So for example: If Company A made 3 purchases in January I want to see sum of these purchases next to company name and sort companies from highest money to lowest for each month.
I wrote a function for that but it doesn't work.
I found the answer and wanted to share here in case anyone would need in the future. This answer belongs to Greg from Google Docs community. I will copy paste the exact answer here:
Hello, See sheet GE.Sheet1. I have added the formulas to demonstrate
your requests.
I want to pull the data from the left chart. Then I want to sum
Same companies revenues. Then I want to put that data dynamically to
the right part.
=QUERY(A:C,"select B, sum(C) where B is not null group by B", 1)
=QUERY(A:C,"select B, A, sum(C) where B is not null group by B, A", 1)
I also want to be able to check how much revenue I got from each
company each month. I also want to see the top 5 companies who made
a purchase in each month.
=QUERY(A:C,"select B, sum(C) where A = '" & M1 & "' and B is not null group by B, A order by sum(C) desc label sum(C) ''", 0)
A limit clause can be added but there is not enough data to test
against. Need more than 5 clients and multiple months.
bests,
GregE

Add data to row if it meets criteria, else ignore

I have raw data in my spreadsheet that comes from a Google Form that looks like the following:
(Cost) (Source) (Frivolous) (Medium) (Comments)
A B C D E
1 15.94 McDonalds Yes Credit was hungry
2 98.32 School No Check Paid for textbooks
3 843.00 Hospital No Check Surgery
4 0 asdff Yes N/A Ignore this one woops
5
6 23.99 Dentist No Credit Check up
I want this data to always be copied to a different sheet, but ONLY the data that matches a condition. That condition in this case is if Frivolous is No, meaning I only want on this separate page to track valid important spending.
My second page I want them to look like the following:
(Cost) (Source) (Frivolous) (Medium) (Comments)
A B C D E
1 98.32 School No Check Paid for textbooks
2 843.00 Hospital No Check Surgery
3 23.99 Dentist No Credit Check up
Notice how empty entries are ignored and also entries with Yes under Frivolous are ignored as well.
How would I achieve this? I have absolutely no idea how that would work since I've only been able to achieve this through filter which will not work for this.
I would like to say a few words in defense of Google Spreadsheets and show some great functions that will work, but they are not supported by [excel].
Query
First you may use simple query:
=QUERY(sheet1!A:E,"select * where C = 'No'")
This single short formula will give the desired result, there's no need to fill right and down.
Filter
Actually you may use filter too. This function seems to work too:
=FILTER(sheet1!A:E,sheet1!C:C="No")
Please, read more info about this functions:
Filter
Query and full Query Language Reference
You'll find many exciting things that could be done in Google spreadsheets.
Actually, I was having some trouble with [google-sheets] ArrayFormula function so I used an old-school formula with SMALL and INDEX function in its array form. In A2,
=iferror(index(Sheet13!A$1:A$99, small(index(row($1:$99)+(Sheet13!$C$1:$C$99<>"no")*1E+99, 0, 0), row(1:1))), "")
Fill both right and down.
So you were in fact correct that this could be solved in [excel] with an identical solution as [google-spreadsheet]. However, there are superior methods in newer [exce] (2010+) using the AGGREGATE function that [google-spreadsheet] does not support and I'm sure that [google-sheets] has more elegant functions that I am not recalling right this moment.
Look to Sheet13 and Sheet14 here for the working sample.

Sum / Counting items in a column that match 3 criteria

Thank you ahead of time for anyone who can help me with this, I think I am close, but it still isn't working.
I have a simple sheet activity reporting sheet that I am asking staff to complete over the upcoming year - It has 5 columns:
Column A: Date -In format (4/4/2013 13:30:00)
Column B: Title -In format (text string)
Column C: Attendance -In format (Numbers)V
Column D: Vol led - In format (text string)
Column E: Staff Led - In format (text string)
Using this data I am 90 % positive that I can aggregate on a different summary sheet that contains some static data like months (in the B column) to aggregate on. I am having trouble configuring the criteria in the filters though to cause the correct output to either sum or count .
Quantity of events ed by either staff or vol, if neither box is checked the event should not be counted) Right now I am trying this but it is not working
=SUM(FILTER('Hostel Activities'!A:A,MONTH('Hostel Activities'!A:A)=$B3, NOT(AND(ISBLANK('Hostel Activities'!D:D),ISBLANK('Hostel Activities'!E:E)))
Total number of attendance in a month for activities led by staff or volunteers Right now I am trying this but it is not working
=SUM(FILTER('Hostel Activities'!A:A,MONTH('Hostel Activities'!A:A)=$B3, NOT(AND(ISBLANK('Hostel Activities'!D:D),ISBLANK('Hostel Activities'!E:E)))
THIE WORKS! ## Heading ##Total number of volunteer led activities in a month for activities Right now I am using this and it IS working
=COUNT(FILTER('Hostel Activities'!A:A,month('Hostel Activities'!A:A)=B3,not(isblank('Hostel Activities'!E:E))))
Thank you for any assistance and/or guidance
Danny
The first problem I see with your first two formulas is that you're calling SUM on your FILTER result. But the FILTER is returning the column A, which are dates. So, your basically summing dates, which will surely not yield the result you're looking for. Why are you not using COUNT, as you did on your last formula?
Second, the first two formulas you pasted are identical, how do you expect them to return different results?
It seems that for the first two want to sum an OR condition. You can do this two ways (that I can think of now). The simpler to understand is just to sum two COUNT(FILTER(... formulas, one for each criteria, e.g.
=COUNT(FILTER('Hostel Activities'!A:A,month('Hostel Activities'!A:A)=B3,not(isblank('Hostel Activities'!D:D)))) + B6
Assuming that on B6 is the other COUNT formula (the 3rd one, that already works).
Another option would be to use an OR function as criteria for the FILTER. Like this:
=COUNT(FILTER('Hostel Activities'!A:A,month('Hostel Activities'!A:A)=B3, OR(NOT(ISBLANK('Hostel Activities'!E:E)), NOT(ISBLANK('Hostel Activities1!D:D))) ))
I believe I have figured out a method that works by making some adjustments in the formulas and the source data.
Basically
IN THE SOURCE REPORTING DATA:
I combined columns D and E into the same column and added data validation so the coordinator has to enter if the activity is led by staff,volunteer, or neither.
IN THE MONTHLY AGGREGATION REPORT:
To count the number of activities led by either staff or volunteers I used this :
=COUNT(FILTER('Hostel Activities'!A:A,month('Hostel Activities'!A:A)=B3,'Hostel Activities'!D:D="Staff"))+E3
*E3 is the count of volunteer led activities which is found using this formula:
=COUNT(FILTER('Hostel Activities'!A:A,month('Hostel Activities'!A:A)=B3,'Hostel Activities'!D:D="Volunteer"))
Adding up the number of participants in activities run by either staff or volunteers was a little more difficult, but I was able to do it by adding up 2 unique equations. I would prefer using an OR statement in the filter criteria, but I just couldn't get that to work. This is how I was able to make it happen:
=SUM(FILTER('Hostel Activities'!C:C,month('Hostel Activities'!A:A)=B3,'Hostel Activities'!D:D="Staff")) + SUM(FILTER('Hostel Activities'!C:C,month('Hostel Activities'!A:A)=B3,'Hostel Activities'!D:D="Volunteer"))
Thank you all for your assistance

Resources