Goal:
Retrieve the requested result from the "Requested value".
Current & normal value | Requested value
----------------------------------------
320 | 320
8256 | 8,256
159 | 159
10456789 | 10,456,789
2321654,75 | 2,321,655
201987,5 | 201,988
5321877 | 5,321,877
Problem:
How should I do it in order to gain a number format that is similiar as in the "Requested value" in Excel?
The current value I have is "Current & normal value"
I'm retrieving data from data mart and paste it into a excel dokucment with PowerPivot.
The value is used as a measurement and more different mesurement will be used so if it possible to reuse the functionality.
When creating the numeric/values elements of PowerPivot it's good practice to explicitly create them as measures. e.g. if your number is the sum of the sales column you would write:
[Sales Measure] = SUM('table1'[Sales])
One of the options you will get when creating the measure is to format the number and while it isn't as comprehensive as standard Excel, you can achieve the 'requested value' format you indicate above.
HTH
Jacob
Related
As usual, I have set a goal, way beyond my skills...
I need to get data from 2 sheets, One has a lot more entries than the other (a master list I guess you could say). Any entry in the smaller sheet will always have a matching entry in the Master, but not necessarily the other way round.
I have written what I need in pseudo query syntax, but I need help getting this to work...
QUERY the 'Catalog' sheet and get TITLE, SUBTITLE, STATUS, TITLE-ID WHERE the STATUS does NOT have the word 'Retired' in it.
Then Query 'Report_Dec 2017' and get UNITS, USD, GPB, EUR WHERE TITLE-ID from 'Report_Dec 2017' Matches TITLE-ID from 'Catalog'
Catalog (master)
| TITLE | SUBTITLE | STATUS | TITLE-ID |
Report_Nov_2017
| UNITS | USD | GPB | EUR | (has TITLE-ID also, but don't need this twice)
Final result should look like this:
| TITLE | SUBTITLE | STATUS | TITLE-ID | UNITS | USD | GPB | EUR |
The end result should only ever have a max number of entries equal to that of from 'Report_Nov 2017', So the Catalog might have 100 total entries but since only 20 units were sold in November, then the result will only show 20
First of all is that possible? And secondly, if it is, can someone point me in the right direction?
EDIT UPDATE
I have made some progress with this, but I am stuck on a strange issue...
This is my google sheet:https://docs.google.com/spreadsheets/d/10uXJVilUqAnSE_ZPlA6VKMBl0DCFRt_WqzYYl-c4Syc/edit?usp=sharing
This is my current formula:
=ArrayFormula(query({to_text(Catalog!B:J),to_text('Report_Nov 2017'!A:J)},"SELECT Col1,Col3,Col4,Col9,Col16,Col17,Col18,Col19 where Col4 != 'Retired' and Col15 MATCHES '"&textjoin("|", TRUE, Catalog!J2:J)&"'",1))
I am getting a result where the entries returned from Catalog are not matching the entries returned from ReportNov2017 - It just seems to be grabbing the first 25 results from Catalog instead of checking to see if the TITLE ID matches in ReportNov2017 - Any Ideas where Im going wrong?
I suggest you split the task into smaller tasks:
add some columns to the report sheet: | TITLE | SUBTITLE | STATUS |. Get their values from Catalog (master). You may try vlookup arrayformula to automate this. See the article.
Then use simple query formula to get the rest.
I need some help figuring out some Google Sheets function. I'm trying to look for the value of an adjacent cell based on a key. The problem is that the table has several rows and columns to search for. For example:
| A | B | C | D |
1 | Alpha | 5 | Bravo | 10 |
2 | Charlie | 15 | Delta | 20 |
The list goes on for several more rows and colums. What I'm looking for for example, is when a search use "Delta" as my search key, it will return the value 20 for me. I appreciate your help. Thanks!
Here is the answer I got on the web application community:
https://webapps.stackexchange.com/questions/90198/how-to-get-value-of-adjacent-cell-based-on-key-if-the-table-is-split-into-multi
You can still use vlookup for this, by stacking the lookup tables into one using the array notation {first ; second; third} which means first above second above third. Example:
=vlookup("Delta", {A:B; C:D}, 2, False)
returns 20.
Try:
=offset(lookup("Delta",A1:D2),0,1)
You could use the following:
=ArrayFormula(INDEX($A$1:$D$2,MIN(IF($A$1:$D$2=$G$1,ROW($A$1:$D$2))),MIN(IF($A$1:$D$2=$G$1,COLUMN($A$1:$D$2)))+1))
This could by done in several ways.
Use RegEx
=regexextract(CONCATENATE(A1:D),F6 & "(\d+)")
where F6 is cell with lookup value i.e. "Delta"
Use lookup
=INDEX(A:D,MATCH(LOOKUP(F6,A1:D,A1:A),A1:A),MATCH(F6,INDIRECT(MATCH(LOOKUP(F6,A1:D,A1:A),A1:A)&":"&MATCH(LOOKUP(F6,A1:D,A1:A),A1:A)))+1)
where F6 is cell with lookup value i.e. "Delta", look at example.
MATCH(LOOKUP(F6,A1:D,A1:A),A1:A) is used 3 times, so it could be counted in separate cell.
I’ve got a question about something I’m trying to achieve in Google spreadsheets. I’ve got the following table:
| NAME | COUNTRY |
--------------------------------------------------
| Alpha | GER*1, SWE*3 |
--------------------------------------------------
| Beta | GER*5, SWE*1 |
--------------------------------------------------
| Gamma | SWE*5, GER*3 |
--------------------------------------------------
| Delta | SWE*2, GER*1 |
--------------------------------------------------
Now I’d like to be able to calculate how many SWE there are in line Gamma. I’d need spreadsheets to return an integer value, in my example the correct one would be 5.
However, I’d also like to be able to calculate the total number of GER in line Alpha to Delta, also returned as an integer value, in this case the result should be 1+5+3+1 = 10.
As you can see I’m dealing with both strings and integers in a single cell. If it would be possible to for example create an array of all GER*(INTEGER), then delete the GER* and have an array of only the integers that might help me?
I’ve searched here, googled around and fiddled with spreadsheets to try and come to a solution but either I’m too daft or it’s not as trivial as I thought it’d be. Any help would be much appreciated.
To calculate the total number of GER in line Alpha to Delta (assuming your data extends from row 2 to row 5) , try:
=sum(ArrayFormula(iferror(regexextract(B2:B5, "GER\*(\d+)")+0,0)))
To calculate how many SWE there are in line Gamma, try:
=sum(ArrayFormula(iferror(regexextract(filter(B2:B6, A2:A6="Gamma"), "SWE\*(\d+)")+0,0)))
Change the ranges so that they suit your actual data range and see if that works ?
You could use one of the Text functions, like FIND together with MID. REGEXEXTRACT is even more powerful but harder to use. When you have the substring, use VALUE to get the numeric value from it.
For the summary, the easiest is probably to create an extra column, extract the GER value into it as above, and SUM that column.
Here's the function reference for Google Spreadsheets: https://support.google.com/docs/table/25273?hl=en
What I want is to easily multiply a number by another number for each column and add them up at the end in Google Sheets. For example:
User | Points 1 | Points 2 | Points 3 | Total
| 5 | 1 | 4 |
-----+----------+----------+----------+------
Jane | 2 | 3 | 0 | 13 (2*5 + 3*1 + 0*4)
John | 1 | 11 | 4 | 32 (1*5 + 11*1 + 4*4)
So it's easy enough to make this formula for the total:
= B3*$B$2 + C3*$C$2 + D3*$D$2
The problem is I frequently need to insert additional columns or even remove some columns. So then I have to mess with all the formulas. It's a pain... we have many spreadsheets with these formulas. I wish there was a formula like SUM(B3:D3) where I could just specify a range. Is there anything like MULTIPLY_AND_SUM(B2:D2, B3:D3) that would do this? Then I could insert columns in the middle and the range would still work.
There is a built in function in Google Sheets that does exactly what you are looking for: SUMPRODUCT.
In your example the formula would be:
=sumproduct(B$2:D$2,B3:D3)
Click here for more information about this function.
You can accomplish that without requiring a special-purpose function.
In E3, try this (and copy it to the rest of your rows):
=sum(arrayformula(B3:D3*B$2:D$2))
You can read about arrayformula here.
As long as you introduce new columns between B and D, this formula will automatically adjust. If you add new columns outside of that range, you'll need to edit (and cut & paste).
On it's own, arrayformula(B3:D3*B$2:D$2) operates over each value in B3:D3 in turn, multiplying it by the corresponding value in B$2:D$2. (Note the use of absolute references to 'lock down' to row 2.) The result in this case is three values, [10,3,0], arranged horizontally in three rows because that matches the dimensions of the ranges.
The enveloping sum() function adds up the values of the array produced by arrayformula, which is 13 in this case.
As you copy that formula to other rows, the relative range references get updated for the new row.
I have s lot of scenarios that are identical, they only differs by data which are passed to them.
This is example:
Feature: Linking facts from a report into Excel document
In order to link facts to an Excel document
As an user having access to report
I want to click on fact's value in the report
Scenario: Any uri item
Given I am logged as admin with admin
And I have selected Sample Project
And I have chosen to view report presentation view containing data from factcollection1 and all periods and all clients
When I click on excel cell C2
And I click on the value in 2 column of the row entitled any uri item
Then Excel cell C2 should contain value some internet address
Scenario: Base64 binary item
Given I am logged as admin with admin
And I have selected Sample Project
And I have chosen to view report presentation view containing data from factcollection1 and all periods and all clients
When I click on excel cell F3
And I click on the value in 2 column of the row entitled base64 binary item
Then Excel cell F3 should contain value asdf
Scenario: Boolean item
Given I am logged as admin with admin
And I have selected Sample Project
And I have chosen to view report presentation view containing data from factcollection1 and all periods and all clients
When I click on excel cell J3
And I click on the value in 2 column of the row entitled boolean item
Then Excel cell J3 should contain value true
I would like to shorten this to look something like following:
before scenario:
Given I am logged as admin with admin
And I have selected Sample Project
And I have chosen to view report presentation view containing data from factcollection1 and all periods and all clients
scenario:
When I click on excel cell XX
And I click on the value in YY column of the row entitled ZZ
Then Excel cell YY should contain value WW
and than some table data, like:
| XX | YY | ZZ | WW |
| C2 | 2 | any uri item | some internet address |
| F3 | 2 | base64 binary item | asdf |
| J3 | 2 | boolean item | true |
I found an solution.
There is an scenario outline with this ability.
Scenario Outline: display label in selected language
Given I am logged as <username> with <password>
And I have clicked on <button> button
Then result should be some result
Examples:
| username | password | button |
| john | doe | first |
| foo | bar | second |
You could use Scenario Outline instead of Scenario. Your example would look something like this:
Scenario Outline:
Given I am logged as admin with admin
And I have selected Sample Project
And I have chosen to view report presentation view containing data from factcollection1 and all periods and all clients
When I click on excel cell '<Cell>'
And I click on the value in '<Column>' column of the row entitled '<Row>'
Then Excel cell '<Cell>' should contain value '<CellValue>'
Examples:
| Cell | Column | Row | CellValue |
| C2 | 2 | any uri item | some internet address |
| F3 | 2 | base64 binary item | asdf |
| J3 | 2 | boolean item | true |
This is a very interesting question and I have spent some time researching what I call "data driven Specifications". This is partly inspired by the "row-test" or "data-driven-test" features that many common test frameworks offer.
Not that I use the terms "Scenario" and "Specification" synonmous, however I prefer the latter.
Similar to a normal unit test, a BDD specification is composed of three parts. A common template used is the "Given X When Y Then Z" formula. What you have discovered is that for a lot of your specifications the "X" part stays the same. Whenever I encounter such a situation, I try to create a Fixture class to abstract this. For example, one of those classes might be a LoggedInUserFixture which sets up a logged in user and makes it available to the test.
Very often, you'll find the need to compose this fixture with other fixtures, to create the setting for your specification. For example you may need a LoggedInUserFixture and a UserWithSampleProjectSelected for a single Specification. The easiest way to do this is to create another fixture class that will setup its child fixtures and makes them individually available to your test.
I am still resisting the urge to extract a common pattern for composing fixtures and make a test framework support this.
To come back to the suggestion to use data to drive specifications, I think it is a valid and useful patterns, I usually make the data drive my fixture creation (the fixture has an appropriate constructor for data injection then). See SubSpec's Theorie feature for details.
This answer is 8 years too late, but Gherkin has a way of eliminating this duplication. It's called the Scenario Background:
Feature: ...
In order to ...
As a ...
I want to ...
Background:
Given common step 1
And common step 2
Scenario: A
When ...
Then ...
Scenario: B
When ...
Then ...
More specifically applied to your situation:
Feature: Linking facts from a report into Excel document
In order to link facts to an Excel document
As an user having access to report
I want to click on fact's value in the report
Background:
Given I am logged as admin with admin
And I have selected Sample Project
And I have chosen to view report presentation view containing data from factcollection1 and all periods and all clients
Scenario: Any uri item
When I click on excel cell C2
And I click on the value in 2 column of the row entitled any uri item
Then Excel cell C2 should contain value some internet address
Scenario: Base64 binary item
When I click on excel cell F3
And I click on the value in 2 column of the row entitled base64 binary item
Then Excel cell F3 should contain value asdf
Scenario: Boolean item
When I click on excel cell J3
And I click on the value in 2 column of the row entitled boolean item
Then Excel cell J3 should contain value true
The three common Given steps are moved into the Background, and then each of your scenarios start out with a When.
Nice and tidy.
The reason this is preferable to a scenario outline is because you are dealing with parsing multiple kinds of data. Presumably there is some parsing logic behind the scenes, and parsing each data type could break in different ways during regression testing. Each test should only have one reason to fail, and your original scenarios properly capture that.