I am building a report in Sales force which is having single column data like this
France > Western Europe > Europe > WEST
Now I want split this column into four columns
Country | Sub region | Region | Super Region
France | Western Europe | Europe | West
How can do this ?
Do we have any feature same as we have in Excel to convert text to columns by delimiter
Related
I have data that looks like this
+-----------+-------------+----------+------------+------------+
| Date | Time | Initials | Location 1 | Location 2 |
+-----------+-------------+----------+------------+------------+
| 8/26/2019 | 11:00:00 AM | BI | 39 | 40 |
| 8/26/2019 | 1:30:00 PM | Kk | 12 | 2 |
| 8/27/2019 | 2:30:00 PM | BH | 18 | 37 |
| 8/28/2019 | 3:30:00 AM | BH | 23 | 29 |
+-----------+-------------+----------+------------+------------+
The output should be something very similar to the Google Maps "Popular Times" graph.
I would like to be able to visualize
A graph for each location in this style (attendance over time via hour), which is the average attendance per day of the week
I would also like to be able to specify a given date ex: 8/26/2019 and pull up the exact data for that date
So I figure either there can be a different graph for every location, or maybe have the various locations data show as different colored bars on the graph.
Ultimately I have this data in a spreadsheet and I'm not sure what would even be the best tool to use to report this data. I looked into data studio and google analytics and just using charts inside the sheet.
However the issue seems to be:
Since the data can be both various dates and various times. I'm not sure how or which tools to use to group the data by a given day, or average the data for a given day of the week. I tried using pivot tables but I'm not sure how to report based on that.
which tools to use to group the data by a given day, or average the data for a given day of the week
=QUERY(QUERY(A2:E,
"select A,count(A),sum(D),sum(E),sum(D)+sum(E),avg(D),avg(E),avg(D)+avg(E),max(D)+max(E),min(D)+min(E)
where A is not null
group by A", 0),
"offset 1", 0)
=QUERY(A2:E,
"select A,count(A),sum(D),sum(E),sum(D)+sum(E),avg(D),avg(E),avg(D)+avg(E),max(D)+max(E),min(D)+min(E)
where A is not null
group by A
pivot C", 0)
need to figure out how to take this input and arrange by Day of the week
=ARRAYFORMULA(IF(A2:A, TEXT(A2:A, "ddd"), ))
Also by hour instead of just by date
=ARRAYFORMULA(IF(A2:A, TEXT(TIME(HOUR(B2:B), 0, 0), "hh:mm:ss"), ))
I'm creating a video website that similar to youtube except its targets the indie gaming community.
I'm working on the table design and have run into a bit of stumbling block with the location column.
How do major sites design tables for storing location?
Profile table:
ID | username | country | state
0 | jack | US | New York
1 | ted | Canada | Alberta
OR
ID | username | countryID
0 | jack | 1
1 | ted | 2
Regions table:
ID | country | state
0 | United States | Texas
1 | United states | New york
2 | Canada | Alberta
Or is there some other design I missed?
And what about :
profile Table
ID | username | stateID
0 | jack | 1
1 | ted | 2
states table
ID | countryID | state
0 | 0 | Texas
1 | 0 | New york
2 | 1 | Alberta
countries table
ID | country
0 | United States
1 | Canada
I have no idea how "big" websites handle their data, but anyway I think this would be a matter of preference and business requirements, in the first case the table isn't properly normalized as the state depends on the country, and in the other case the model is [almost] properly normalized (the country could be moved to another table). The first option can be faster when doing lookups et cetera but as it breaks the normalized relational model it can lead to issues when inserting/updating the data (as well as additional storage). Personally I would chose to use the second option (and maybe de-normalize it for analytics processing if needed - I would think it very much depends on the amount of data you expect to handle)
A normalized model would look something like:
profile (**username**, state)
states (**state**, country)
countries (**country**)
The example above doesn't use surrogate keys and only illustrate the model; a database implementation of the model would often use surrogate keys such as UserID, StateID and CountryID although if properly normalized they shouldn't be needed as the entities should be primary keys (as they are candidate keys).
Im building a friendship website. The problem I'm having is where should I store the locations of users ( I need to store two variables [country] [state/province]).
The friendship site has a question and answer table currently that stores users attributes such as user religion , users eye color etc...
Is it appropriate to add two more questions to the userAttributes table? (see option 1 below)
What is your country
Whats is your state / Province
OR
Do country and state belong in there own table separate form the userAttributes table. (see option 2 below)
Option 1 - userAttributes Table
Question | Answer
What is your eye color | blue
What is your eye color | green
What country | Canada
What state / province | Alberta
What state / province | Ontario
What country | United States
What state / province | New York
What state / province | Louisiana
What state / province | Georgia
etc ...
Option 2 - ProfileLocation Table
Id | country | province-state
1 | Canada | Alberta
2 | United States | New York
3 | United States | Louisiana
Note : The website will have probably 900 - 1000 provinces / states so this will really fill up the userAttributes Table.
You have two questions, and a large number of answers which are linked to each other. You should store the answers in two tables, which I'll refer to as countries and provinces. The provinces table links back to the countries table so you can extract the data you need easily.
This gives you
Countries
id | Name
------------------------------
1 | USA
44 | United Kingdom
64 | New Zealand
Provinces
id | Country ID | Name
1 | 1 | Oregon
2 | 1 | Arizona
3 | 1 | Kentucky
4 | 44 | London
5 | 44 | Kent
6 | 64 | Waikato
7 | 64 | Wairarapa
(You can fill in the rest)
A simple query will populate a countries drop-down menu on your web page. An AJAX call and a second simple query can populate a provinces drop-down on the fly (or you could send the lists when the page is loaded and use a little Javascript to populate the drop-down from there).
I have a dataset, which has a list of article names, and a user.
eg.
Article | User
Article1 | ABT
Article1 | ABT
Article2 | ABT
Article1 | MLH
Article2 | MLH
Article2 | MLH
and I have a dataset, which is preparing this in a count, so that the data looks like this:
Article | User | Count
Article1 | ABT | 2
Article2 | ABT | 1
Article1 | MLH | 1
Article2 | MLH | 2
So you can see, I'm just counting the views for each article grouped by the user.
I want to present this in a stacked bar chart, so that the Article is the x-axis and the user is the series, so I can see the popularity of a given article and also see the popularity by user for that article.
eg. (can't post images)
Example Stacked Bar Chart
This works fine, and I have this already, but I want to restrict the actual amount of Articles displayed. I will end up having over 100 articles to display, so i'd like to restrict to top 10-20 articles, but in the same stacked format, so I can't just "TOP N" the dataset, as it could lose series data for a given article.
eg.
Article | User | Count
Article1 | ABT | 100
Article2 | ABT | 98
Article1 | MLH | 10
Article2 | MLH | 2
Putting a "TOP 2" on this would lose series data for the MLH visits to each article.
Is there a way to restrict the X-Axis, after it is prepared for rendering for the chart? Or other solution i've completely missed.
Add a filter to the Category Group (Article):
Expression: =Count(Fields!ArticleName.Value)
Operator: TOP N
Value : 10
returns top 10 for that category after all grouping is applied.
I'm writing a simple booking program for a car rental (a school assignment). Me and my buddy are trying to make the system a little more advanced than the assignment dictates, but we're having some problems we hoped you could help us with.
The idea is that you can reserve a certain car type, and when you get the car it will be one of that type (you don't reserve a specific car, as our assignment dictates, but only a type). Only one customer can have the car on a specific date. As the reservations tick in we have to make sure, that we don't hire out more cars of each type than we've got. The reservations are basically stored with a start date, an end date, and a car type.
If we ignore the car type for now (lets say we only have one type) then the reservations could graphically look something like this:
1/12 2/12 3/12 4/12 5/12 6/12 7/12
|-------------------|
|-----------------|
|-----|
|-------|
|-----------|
|-------------|
If the rental only has three cars it would be possible to rent a car from 3/12 to 5/12 since all days only have 2 car reservations. But how do we know this? Do we have to check each date and count() the number of reservations that spans over that date?
And what if somebody had reserved a car on 4/12, then 3/12 and 5/12 would still only have 2 reservations, but 4/12 would have 3.
Would it be possible to do with a query some how, or do we have to step through each date in the program to check the number of reservations didn't exceed the number of cars?
(This is easy enough with only full dates, but consider the scenario where you could rent the cars on an hourly basis (not only on a daily as here). Then it could be a though one to step through each our if we have a lot of reservations and cars and the timespan is long...)
Hope you have some nice ideas that will help us along. Thanks for taking the time to read the question :)
Mikkel, Denmark
Assume, You have such reservation situation in real life:
1/12 2/12 3/12 4/12 5/12 6/12 7/12
Car1: |-------------------|
Car2: |-----------------|
Car3: |-------| |-----------| |-----|
Car4: |-------------|
Table car
| id | type | registration |
| 1 | 1 | HH1111 |
| 2 | 1 | HH3333 |
| 3 | 2 | HH77 |
| 4 | 3 | DD999 |
Table reservation
| car_id | date_from | date_to |
| 1 | 2013-12-01 | 2013-12-04 |
| 2 | 2013-12-04 | 2013-12-07 |
| 3 | 2013-12-01 | 2013-12-02 |
| 3 | 2013-12-03 | 2013-12-05 |
| 3 | 2013-12-06 | 2013-12-07 |
| 4 | 2013-12-01 | 2013-12-03 |
Now, You must by really simple logic, select all available cars for period
from 2013-12-05 to 2013-12-06
"Select ALL cars, which does not have any reservation with dates, which blocks it for usage"
with brillian mysql select:
select * from car where not exists ( select * from reservation
where car.id = reservation.car_id AND
date_from < '2013-12-06' AND
date_to > '2013-12-05' )
"Would it be possible to do with a query some how, or do we have to step through each date in the program to check the number of reservations didn't exceed the number of cars? (This is easy enough with only full dates,"
The nature of your problem is that a violation of the constraint could appear on any individual date. So logically speaking, it is indeed necessary to do the check for each individual date comprised in a new reservations. The only optimisation possible would be to do the check at the level of "smallest intervals". To do that, you must first compute all the intervals that already appear in the database, and which overlap with your new reservation.
For example, a new reservation for 4/12-6/12 would have to be split into 4/12-5/12 (second line) and 5/12-6/12 (third line). Those individual intervals might be longer than one single day, and you can do the checks on the level of those individual intervals. (They are the same as individual days in this particular example, but a reservation 7/12-19/12 would not have to be split at all.
However, computing this might prove difficult, and there's another caveat: when you're looking al multi-row inserts, you should also be splitting over the other rows to be inserted (and that requires you to record all the inserted rows in a temporary table, otherwise you won't be able to access them).