many =if 's to automatically fill in a column - function

I am in Google Sheets, and I have a column with many choices from a drop down (retail stores, i.e.Home Depot, Walmart) and in another column I want a certain % for tax to get added to the price when the retail store is selected. So in row 2 if I select Walmart in that "retail" column, then in the "tax" column it will automatically insert 9%. When I select Menards from the retail list, in the tax column it would automatically insert 2%. I have 20+ retail stores that I want a certain % automatically inserted into another column. How would I do this?

you may need to add another table with list of all stores and taxes:
Walmart 9%
Menards 2%
Home Depot 3%
... ..
and so on...
Lets call this new table "Store-Taxes". Then just use vlookup formula:
A B
Store Tax
Name1 =ArrayFormula(Vlookup(offset(A2,,,counta(A2:A)), "Store-Taxes", 2, 0))
Name2 ...
Name3 ...
Replace "Store-Taxes" with table's actual reference, like 'Store-Taxes'!A:B. Formula in cell B2 will expand automatically. Look at this example to find out how this technique works.

Related

How can I split my measure into different columns by month in Business Objects WebI?

This task is to be completed using SAP Business Objects WebI 4.2.
I have a table in the following format:
Company Date Amount
A 1/1/2014 100
A 16/2/2014 400
I have a variable called Month that has the Month for each transaction.
I want the table to look like:
Company January February
A 100 400
How can this be done without making a calculated field for each month?
In Webi you can't easily place a distinct category (Company) next to the values of another category (Month) in the same header row. So you have two options:
1) Create a regular horizontal table with three columns: Company, Month, & Value
2) Create a crosstab table with the Company on the left/vertical axis and the Month on the top/horizontal axis. Your values would be in the middle.
Note: if you wanted to do a lot of manual coding, you could set it up the way you want. The first column would hold your Company variable. The next column, "January" would require a formula:
=if([Month]=January) Then [Value]
You'd then have to create 11 more columns, with variables for each:
=if([Month]=February) Then [Value]
=if([Month]=March) Then [Value]
=if([Month]=April) Then [Value]
etc...
It would be tedious to do, and personally I'd go for one of the first two options. But it would work!

MYSQL inserting specific datas from columns

I have a table named Pupils and a table named Bus.
Bus contains an ID,Destination (where it goes to) and Time (when it leaves).
Pupils contains Name,Location(Where it lives) and BusID (Which bus it needs to take).
I want to fill the 'BusID' column with the correct 'ID' from the 'Bus' table (depending on the pupil's location and time selected).
For example, the pupil lives in Tel Aviv and wants a bus at 10:00.
I need to fill his 'BusID' column AND ROW ( there are many pupils) with the same 'ID' in the bus table where Destination equals Tel Aviv and Time equals 10:00.
Is it in anyway possible? I was thinking about using Insert into/Insert into select but it doesn't really fits my needs.
As I meanwhile understood: the pupils are somewhere else (presumably not in T.A.) and want to find the bus that brings them back to T.A. at 10:00 hrs.
This can then be achieved with
-- The id of the bus that travels at 10:00 to T.A.:
select id from bus where destination='Tel Aviv' and time='10:00:00';
-- Update the pupil's record with the bus-id:
update pupils set busid=... where location='Tel Aviv';
-- Together (and that's the answer):
update pupils set busid=(select id
from bus
where destination='Tel Aviv'
and time='10:00:00')
where location='Tel Aviv';
Note that this assumes there is exactly one result row in the first query, i.e. exactly one 10 o'clock bus to T.A.

SSRS Show a percentage of a a total value

I have a regular Table in SSRS. With 3 Groups...
(Parent) STORE - CLERK - PRODUCT (Child)
I have some regular aggregations. How many PRODUCTS Sold by a CLERK , How Many CLERKS Per STORE and Eventually How many PRODUCTS Per STORE
On top of the Regular Sums And Avgs, I need To Find Out The Percentage of PRODUCT (Type) Meaning a Particular value of that Group.
Example STORE 001 Has Sold 10 RADIOS (a PRODUCT) and There has Been 100 RADIOS sold by all Stores
So Basically What I Need is to show STORE 001 is Responsible for 10% of all RADIO Sales.
(A note: Ideally , I would Like to show this To adjust to the Data - So if I add new products It will group those as products (Naturally) but still give me those percentages)
= fields!product.value / sum(fields!product.value)
in its most basic form you would want to use something like this.
The first will give you the total of the current row of data and the second will give you the total of all rows of that product.
Thus you would have 10 / 100 (per your example).
This is assuming that you have your data structured correctly. Depending on the structure of you report you may need to add a scope to your total summation to make sure that you are not totaling any other datasets that may reference the same product or field.
sum(fields!product.value, "--your dataset here--")

SSRS - Matrix Column Subtotals

I'm trying to create a report which has some interesting subtotals which I'm struggling with. Here's what I'm looking to create:
Col Group A (Currency)
Col Group B (Branch)
Row Group A (Account Group)
Row Group B (Open/Close Balance) Amount
Here's an example of what my data could look like:
CAD CAD USD
Main Div A Div B
Account Rec Open 100.00 50.00 25.00
Account Rec Close 123.00 50.00 35.00
Account Pay etc
What I'm trying to accomplish is blank columns after each Col Group without any page breaks. In this example after the CAD currency I'd like to have 4 blank columns to make some calculations (in some cases related to another dataset in the report). Is this possible?
Are you just looking to add some more columns to the Currency group, i.e. in the Designer this will look like:
With the end result like:
I've only added two columns here to keep the image from getting too complicated, but you can add as many as you like.
To do this, I just specified that a Group Footer be included when creating the Currency group, then added another column to the right of the footer row that was created.
Is this the sort of thing you're after?

Microsoft Access selecting records from another table matching current record

It seems I've hit a brick wall in MS Access 2010.
It's kind of hard to explain what I'm trying to achieve, so I'll start with a basic example. Let's say we have two tables: A and B.
A:
ID Price Item
1 5 ABB
2 4 ATV
3 2 CCC
B:
ID Price limit Chosen item
1 3
2 4
3 5
4 6
What I'm trying to achieve is create a Relation from table A to B. Each record in table B has to have associated table A record. It should be based on table A field 'Price' and table B field 'Price limit' in a way that the price of selected record from Table A is lower than the price limit imposed in table B record.
That is, the possible table A records for the first table B record is only CCC, for second - ATV and CCC, while for third and fourth all records are valid.
As far as my limited access knowledge goes, I've figured that I should write a query in "Chosen item" field row source property. I've tried writing it myself, however, without success. Here's what I've come up with:
SELECT [Table A].[ID], [Table A].[Item]
FROM [Table A]
WHERE [Table A].[Val] > [Val];
But it does not work. Could somebody please point me to the right direction?
I think that you want something like this where the dropdown box only contains relevant items:
You can set this up by setting the row source of the combo to say,
select item from ta where price<=forms!tb!pricelimit
And adding a little code
Private Sub Form_Current()
Me.Chosenitem.Requery
End Sub
Note that this method comes with a warning. Usong dropdowns like this on a continuous form can seriously mess up the display of your data on any rows other than the current row. In this case, the display is fine, because the bound column and the data to be displayed are the same, however, if the selection was:
Row Source: select id,item from ta where price<=forms!tb!pricelimit
Bound Column: 1
Column Widths : 0cm;2cm
Data would appear to disappear from records when the selection for the current record produced a list that did not contain IDs for other rows. That is to say, if the selection for the current rows returned IDs 1 and 2 and the next row already had ID 3 chosen, the combo for the next row would appear to empty, and so on down the page.