Count Specific Value in Column as a Total
I am using Oracle 10g, In my worksheet i have created column using Decode Function.I would like to count Flag='Y'(not using group sort).
Could anybody help me on this problem
Eg:
Entered Employment At Exit
Y
Y
N
Y
N
Y
Y
Total = 5
Thanks,
Vikram
Hi Vikram
You need to create another calculation in your worksheet using the DECODE as you suggested. Here is what you need:
DECODE(Entered Employment,'Y',1'0)
Make sure when you create it that you pasted the item name into the calculation and do not type it yourself. Because the name contains spaces Discoverer may think of it as being a variable instead of a column name.
If you do the above you should be able to do a SUM on the new calculation.
Best wishes
Michael
Similar Messages
-
Sorting based on a specific value in Columns
Hi All,
Crystal 2008 version I have. And we are connecting to BW queries as source.
In a crosstab, I want to sort my row values based on a column value.
For example, in rows I have an element with three values . In column I have only one element(month), with couple of month values. My requirement is to sort rows based on a specific month (Mar'09 for example).
.....................Jan'09......Feb'09.....Mar'09
ABC...............10.............323...........33....
XYZ...............32..............33............11....
FGH...............5................34.............55...
But when I try to sort based on the Month, I can not select a specific value(mar'09). And it sorts based on the total value (sum of all months).
How can I achieve this problem?
Thanks
OzanFor {Sort Value}, if you wanted to sort on the Jan column, then substitute the field name that your example shows as 10 in row ABC. For {row value}, substitute the field name that is used in the first column (ABC in the example).
In other words, take the value that you want to sort on, and put it in front of the value currently displaying as the row header. Then, sort on the results.
The purpose of the "000000000.00" is to make the length of the number, when converted to string, a consistent size. This is needed (a) so you know how many characters to strip off when displaying the row value, and (b) so the records don't sort as 1, 12, 2, 234, 235423, 25, 3, ...
HTH,
Carl -
How can count Duplicate value in column?
Regards:
M K SINGHLike this:
SQL> create table t(a number);
Table created.
SQL> insert into t values (1);
1 row created.
SQL> insert into t values (2);
1 row created.
SQL> insert into t values (2);
1 row created.
SQL> insert into t values (3);
1 row created.
SQL> insert into t values (4);
1 row created.
SQL> commit;
Commit complete.
SQL> select * from t;
A
1
2
2
3
4
SQL> select a, count(*) from t group by a;
A COUNT(*)
1 1
2 2
4 1
3 1
SQL> -
Counting specific value for a characterstics in Infoset query
Hi Experts,
I have an query built on infoset which includes some charaterstics.
Now for a characterstic it showing following values in a query :
<b>CHARACTERSTICS#NAME</b>
================================================
YES
NO
YES
YES
NOT ASSIGNED
NOT ASSIGNED
YES
NO
NOT ASSIGNED
NOT ASSIGNED
================================================
<b>here I want to display Count for 'YES' i.e. 4</b>
================================================
<b>Also I want to show blank for 'NOT ASSIGNED' value.</b>
Is it possible or not please let me know.
It's urgent !
Thanx in Adv.
Message was edited by:
jaisingh yadav
Message was edited by:
jaisingh yadavSet display to 'key' instead of ' Text' in the Query Designer to show #. Also include a counter keyfigure in your Characteristic infoobject which is filled with a value of 1 for every entry where the value is "YES" (during master data loading in a routine or FOX formula). Then include the counting keyfigure in your query. Use a condition in your query if necessary to just show the "YES" values.
-
How can I sum the values in a given column on sheet 1 i.e. A1:A50 based on the adjacent columns specific value i.e. B1:B50 = “Dinning Room” on sheet 2
For Example:
SHEET 1
A
B
$50
Dinning Room
$800
Dinning Room
$300
Kitchen
$1,000
Master Bedroom
$100
Dinning Room
SHEET 2
Display the total SUM amount of each Project based on Sheet 1
Project Name
Total Cost
Dinning Room
$950
Kitchen
$300Would be a good idea to open iWork Formulas and Functions User Guide and search for the description of the function named SUMIF
The Guide is available for every user thru the Help menu.
Yvan KOENIG (VALLAURIS, France) jeudi 19 mai 2011 17:32:42
Please :
Search for questions similar to your own before submitting them to the community
To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer ! -
How to count ONLY fields with a specific value
I modified the code below from the API reference to count combobox fields with a value of "MT" so I could total the number of a specific choice the form user input.
var count = 0;
for (var i=0; i<this.numFields; i++)
var fname = this.getNthFieldName(i);
if ( this.getField(fname).type == "combobox" && this.getField(fname).value == "MT" ) count++;
this.getField("mTurb").value = count.value;
Here's the problem: I tried to use a similar script, modified only slightly from this form, in another total field to tally a different choice made with comboboxes and the script continues to tally the first choice. An example of one of the modified versions of the script is below.
var gcount = 0;
for (var i=0; i<this.numFields; i++)
var gname = this.getNthFieldName(i);
if ( this.getField(gname).type == "combobox" && this.getField(gname).value == "MT" ) gcount++;
this.getField("gPack").value = gcount.value;
I suspect I'm just missing something painfully obvious to seasoned scripters, but I can't seem to figure it out and I need this script to be able to count the number of 9 different options in the comboboxes.OK, you can use a script like the following as the custom calculate script for the text fields that perform the counts:
// Custom calculate script for text field
(function () {
// Declare and initialize variables
var fn, s = "MT", count = 0;
// Loop through the combo boxes
for (var i = 1; i < 25; i++) {
// Determine the current field name
fn = "M" + util.printf("%02d", i));
// See if the field value matches
if (getField(fn).valueAsString === s) count++
// Set this field value to the count
event.value = count;
Change the value of the "s" variable to match the item that you want to count. The first and last lines prevent the unnecessary creatio of global variables, which is good. It also makes it easy to transfer to a more general document-level routine, which would be event better, something like:
// Custom calculate script for text field
function getCBCount(s) {
var fn, count = 0;
// Loop through the combo boxes
for (var i = 1; i < 25; i++) {
// Determine the current field name
fn = "M" + util.printf("%02d", i));
// See if the field value matches
if (getField(fn).valueAsString === s) count++
// Set this field value to the count
event.value = count;
You would then call this function from the individual text boxes with the following custom calculate script:
getCBCount("MT");
and replace "MT" with the vlaue you want to count. -
Totaling specific value within data
I have data that contains a bunch of "Y" (yes) and "N" (no) values. I want to total up only the "Y" values. The only way I have found so far is build another column with 1's and 0's, then sum that column, but that looks goofy. Any ideas? I cant seem to "edit" the totals to the extent of adding a decode function or something to limit the count just to "Y".
Thanks,
CCI have data that contains a bunch of "Y" (yes) and "N" (no) values. I want to total up only the "Y" values. The only way I have found so far is build another column with 1's and 0's, then sum that column, but that looks goofy. Any ideas? I cant seem to "edit" the totals to the extent of adding a decode function or something to limit the count just to "Y".
Thanks,
CC -
How to count unique values based on specific criteria
Hello,
I need to count the number of unique values in column A but only if the text in column I is a specific word - how do I do this?Let's say the values are in A1:A10 and they are numeric, and the text is in I1:I10.
As an array formula, confirmed with Ctrl+Shift+Enter:
=SUM(IF(I1:I10="word",1/COUNTIFS(A1:A10,A1:A10,I1:I10,"word")))
where "word" is the specific word you're looking for.
Regards, Hans Vogelaar (http://www.eileenslounge.com) -
Reporting counts on multi-value lookup columns
Hi,
I have a list containing 2 columns - student, and subjects. Subjects is a multi-value lookup column. Students may study multiple subjects. What I'm trying to achieve is a simple pie chart (I don't care if it's done using SharePoint Web Part, Excel or
SSRS) that displays a breakdown of how many students are studying each subject.
So if I have 2 list entries:
Person 1, Science, Maths
Person 2 , Maths
Person 3 , Science
The report/chart would report 2 Science and 3 Maths. What I'm struggling with is that because the data is stored in an un-normalized fashion ('#;') separated it's not possible to do straight charts without coding (C# or VBS). I
would have assumed that this issue would be widely spread but I've had no luck looking through forums. Does anyone have any experience/;ideas on how to handle this??
Thanks.
MDBHi
From your description, my understanding is that you want to get counted values of a Multi-Value lookup column.
You can get counted values of a Multi-Value lookup column
in DVWP using XSLT.
Refer to the following post:
https://social.msdn.microsoft.com/Forums/en-US/f9d4cf16-4460-48a7-9514-dee19503b9fc/getting-counted-values-of-a-multivalue-lookup-column-in-dvwp-using-xslt?forum=sharepointdevelopmentprevious
Best Regards,
Lisa Chen
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected] -
Print out a column value only if another column has a specific value (CASE Statement)
Hello all,
I tried many hours to find a solution for the following request but wasn't successful. Maybe you could help me.
I've using the already existing SQL Views in Microsoft Service Manager to do some basic reporting about my tickets.There is no closed date in the activity tickets so I decided to print out the lastmodified timestamp when the status is "closed".
That's my query:
SELECT DISTINCT
dbo.DisplayStringView.DisplayName AS Status,
CASE WHEN dbo.DisplayStringView.DisplayName = 'Closed' THEN dbo.DisplayStringView.LastModified ELSE 'NO CLOSED Date' END AS ClosedDate
FROM dbo.MTV_System$WorkItem$Activity$ManualActivity LEFT OUTER JOIN
dbo.DisplayStringView ON dbo.MTV_System$WorkItem$Activity$ManualActivity.Status_8895EC8D_2CBF_0D9D_E8EC_524DEFA00014 = dbo.DisplayStringView.LTStringId
Unfortunatelly I'm not getting the value from dbo.DisplayStringView.LastModified. SQL outputs that it is not possible to convert the string to date/time.
I think there is a problem with the CASE statement in combination with a value select.
Any ideas how to print out a column value only if another column has a specific value?I think it is the other way if you want the missing date shown as a string.
CASE
WHEN
dbo.DisplayStringView.DisplayName
=
'Closed'
THEN
Convert( varchar(10),dbo.DisplayStringView.LastModified
, 101) ELSE
'NO CLOSED Date'
END
AS
ClosedDate -
How to get count of unique values of column B for each unique value of column A in Excel 2010?
I have an excel sheet containing 72,000 rows in Excel 2010, column A is "site name", column B is category. I want a result that shows number of sites for each category.
Column A Column B
site 1 Category 1
Site 1 Category 1
Site 2 Category 1
site 3 Category 2
site 3 Category 2
site 4 Category 2
site 5 Category 2
I want this result:
Category 1 2
Category 2 3
I tried some formula in a 3rd column and created a pivot table on that column, but it did not give me the result i want.
Any one has an idea ? what is the easiest way to achieve this?
Appreciate any pointerI tried both formula referenced in these two post (I think they are a little simpler than the one above):
http://stackoverflow.com/questions/11876238/simple-pivot-table-to-count-unique-values
http://stackoverflow.com/questions/18898138/pivot-table-count-unique-values-excel-2010
They both worked! and I got the result for my 72,000 rows!
Thanks for your help! -
Return the rows of the table where a column contains a specific value first
I want my query to return the rows of the table where a column contains a specific values first in a certain order, and then return the rest of the rows alphabetized.
For Example:
Country
ALBANIA
ARGENTINA
AUSTRALIA
CANADA
USA
Now i want USA and CANADA on top in that order and then other in alphabetized order.
Edited by: 986155 on Feb 4, 2013 11:12 PM986155 wrote:
If it is 2 then i can write a case... i want generalised one where may be around 5 or 6 mentioned should be in descending order at the top and remaining in ascending order there after.Computers tend not to work in 'generalized' ways... they require specifics.
If you store your "top" countries in a table you can then simply do something like...
SQL> ed
Wrote file afiedt.buf
1 with c as (select 'USA' country from dual union
2 select 'Germany' from dual union
3 select 'India' from dual union
4 select 'Australia' from dual union
5 select 'Japan' from dual union
6 select 'Canada' from dual union
7 select 'United Kingdom' from dual union
8 select 'France' from dual union
9 select 'Spain' from dual union
10 select 'Italy' from dual
11 )
12 ,t as (-- top countries
13 select 'USA' country from dual union
14 select 'United Kingdom' from dual union
15 select 'Canada' from dual
16 )
17 select c.country
18 from c left outer join t on (t.country = c.country)
19* ORDER BY t.country, c.country
SQL> /
COUNTRY
Canada
USA
United Kingdom
Australia
France
Germany
India
Italy
Japan
Spain
10 rows selected. -
I am using a DAQ-1200 lab card (8253/54) to run a micro-stepping motor for a NASA research project. I need to tell LabVIEW to send a logic high (+5V) to one of the digital ports when my counter (ICTR Control) reaches a specific value. The logic high trips a relay which changes the direction of the motor, but I cannot figure out how to trigger it. Thanks!
Wire your counter T/F condition to a Case statement, and when T, have the 'Write to Digital Line.VI' output the logic high or low as appropriate. That VI is in the Functions>Data Acquisition>Digital I/O palette. This should work. Good Luck - Doug
-
For some business requirements, users want to extract values from a multi-value enabled lookup column
and add items to another list based on each separate value. In contrast, others want to find duplicate values in the list and merge associated values to a multi-value enabled column and then
add items to another list based on the merged value. All of these can be achieved using SharePoint Designer 2013 Workflow.
How to extract values from a multi-value enabled lookup column and add items to another list based
on each separate value using SharePoint Designer 2013.
Important actions: Loop Shape; Utility Actions
Three scenarios
Things to note
Steps to create Workflow
How to merge values to a multi-value enabled column and add item to another list based on the
merged value using SharePoint Designer 2013.
Important actions: Call HTTP Web Service; Build Dictionary
Things to note
Steps to create Workflow
How to
extract values from a multi-value enabled lookup column and
add items to another list based on each separate value using SharePoint Designer 2013.
For example, they have three lists as below. They want to
extract values from the Destinations column
in Lookup2 and add items to Lookup3 based on each country and set Title to current item: ID.
Lookup1:
Title (Single line of text)
Lookup2:
Title (Single line of text), Destinations (Lookup; Get information from: Lookup1 in Title column).\
Lookup3:
Title (Single line of text), Country (Single line of text).
Important action
1. Loop Shape: SharePoint Designer 2013 support two types of loops: loop n times and loop with condition.
Loops must also conform to the following rules:
Loops must be within a stage, and stages cannot be within a loop.
Steps may be within a loop.
Loops may have only one entry and one exit point.
2. Utility Actions: It contains many actions, such as ‘Extract Substring from Index of String’ and ‘Find substring in String’.
Three scenarios
We need to loop through the string returned from the look up column and look for commas. There are three
scenarios:
1. No comma but string is non-empty so there is only one country.
2. At least one comma so there is at least two or more countries to loop.
3. In the loop we have consumed all the commas so we have found the last country.
Things to note
There are two things to note:
1. "Find string in string (output to Variable:index)" will return -1 if doesn't find
the searched for string.
2. In the opening statement "Set Variable: Countries to Current Item:Destinations" set the return
field as "Lookup Values, Comma Delimited".
Steps to create Workflow
Create a custom list named Lookup1.
Create a custom list named Lookup2, add column: Destinations (Lookup; Get information from: Lookup1 in Title column).
Create a custom list named Lookup3, add column: Country (Single line of text).
Create a workflow associated to Lookup2.
Add conditions and actions:
Start the workflow automatically when an item is created.
Add item to Lookup2, then workflow will be started automatically and create multiple items to lookup3.
See the below in workflow History List:
How to merge values to a multi-value enabled column and add item to another list based on the
merged value using SharePoint Designer 2013
For example, they have three lists as below. They want to find duplicate values in the Title column in
Lookup3 and merge country column to a multi-value enabled column and then add item to lookup2 and set the Title to Current Item: Title.
Lookup1:
Title (Single line of text)
Lookup3:
Title (Single line of text), Country (Single line of text).
Lookup2:
Title (Single line of text), Test (Single line of text).
Important actions
"Call HTTP Web Service"
action: In SharePoint 2013 workflows, we can call a web service using a new action introduced in SharePoint 2013 named Call HTTP Web Service. This action
is flexible and allows you to make simple calls to a web service easily, or, if needed, you can create more complex calls using HTTP verbs as well as allowing you to add HTTP headers.
“Build Dictionary"
action:
The Dictionary variable type is a new variable type in the SharePoint 2013 Workflow.
The following are the three actions specifically designed for the Dictionary variable type: Build Dictionary, Count Items in a Dictionary and Get an Item from a Dictionary.
The "Call HTTP Web Service" workflow action would be useless without the new "Dictionary" workflow action.
Things to note
The
HTTP URI is set to https://sitename/_api/web/lists/GetByTitle('listname')/items?$orderby=Id%20desc and the HTTP method is set to “GET”. Then the list will be sort by Id in descending order.
Use Get
d/results(0)/Id form
Variable: ResponseContent (Output to
Variable: maxid) to get the Max ID.
Use Set
Variable: minid to Current List:ID to get the Min ID.
Use Copy from
Variable: destianation , starting at
1 (Output to
Variable: destianation) to remove the space.
Steps to create Workflow
Create a custom list named Lookup1.
Create a custom list named Lookup2, add column: Test (Single line of text).
Create a custom list named Lookup3, add column: Country (Single line of text).
Create a workflow associated to Lookup3.
Add a new "Build Dictionary" action
to define the http request header:
Add a Call HTTP Web Serviceaction, click on
this and paste your http request.
To associate the
RequestHeader variable, select the Call action property,
set the
RequestHeaders property to
RequestHeader:
In the Call action, click on
response and associate the response to a new
variable: ResponseContent (of type Dictionary).
After the Call action add Get item from Dictionary action to get the Max ID.
Add Set Workflow Variable action to get the Min ID.
Add Loop Shape (Loop with Condition) to get all the duplicate titles and integrate them to a string.
Create item in Lookup2.
The final Stage should look like this:
Start the workflow automatically when an item is created.
Add item to Lookup3, then workflow will be started automatically and create item to lookup2.
See the below in workflow History List:
References
SharePoint Designer 2013 - Extracting values from a multi-value enabled lookup column into a dictionary as separate items:
http://social.technet.microsoft.com/Forums/en-US/97d34468-1b53-4741-88b0-958472f8ca9a/sharepoint-designer-2013-extracting-values-from-a-multivalue-enabled-lookup-column-into-a
Workflow actions quick reference (SharePoint 2013 Workflow platform):
http://msdn.microsoft.com/en-us/library/jj164026.aspx
Understanding Dictionary actions in SharePoint Designer 2013:
http://msdn.microsoft.com/en-us/library/office/jj554504.aspx
Working with Web Services in SharePoint 2013 Workflows using SharePoint Designer 2013:
http://msdn.microsoft.com/en-us/library/office/dn567558.aspx
Calling the SharePoint 2013 Rest API from a SharePoint Designer Workflow:
http://sergeluca.wordpress.com/2013/04/09/calling-the-sharepoint-2013-rest-api-from-a-sharepoint-designer-workflow/GREAT info, but it may be helpful to note that when replacing a portion of the variable "Countries" with a whitespace character, you may cause the workflow to fail in a few specific cases (certain lookup fields will not accept this and will automatically
cancel). I only found this out when recreating your workflow on a similar, but much more complex list set.
To resolve this issue, I used another utility action (Extract Substring from Index of List) to clear out the whitespace. I configured it as "Copy from
Variable: Countries, starting at
1 (Output to Variable: Countries), which takes care of this issue in those few cases.
Otherwise, WOW! AWESOME JOB! Thanks! :) -
I have to record league results and the points against each game and have a total of 84 to record for 15 teams.
I have set it up to record Points, For and Against goals across the page from column C to CH but I have been unable to record the number of times games have been won, lost or drawn.
Is it possible to count each value and have it updated each time Ienter the new results in a new column showing won, lost or drawn?
Any assistance that you can offer will be most appreciatedHere's the code:
I have used a Hashtable to store the value and its number of occurrences. Finally to print the result, I used the toString() method of Hashtable but you can print it in your own way, if u wish.
import java.util.Hashtable;
import java.io.*;
public class Repeating {
public static void main(String args[]) {
int[] num = new int[6];
try {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter six numbers: (press Enter after each number)");
for ( int i=0 ; i<num.length ; i++ ) {
System.out.print("Enter number #" + i + ": ");
num[i] = Integer.parseInt(br.readLine());
System.out.println("The array is: ");
for ( int i=0 ; i<num.length ; i++ ) {
System.out.print(num[i] + " ");
System.out.println("");
} catch (Exception e) {
System.out.println("Enter only one number in each line ...\n\n");
e.printStackTrace();
Hashtable h = new Hashtable();
for ( int i=0 ; i<num.length ; i++ ) {
Integer ii = new Integer(num);
if ( h.containsKey(ii) ) {
Integer val = (Integer) h.get(ii);
h.put(ii, new Integer(val.intValue() + 1));
} else {
h.put(ii, new Integer(1));
System.out.println("\nThe result: (value=number of occurrences)");
System.out.println(h);
Maybe you are looking for
-
Assigning custom,stamp duty,custom clearing agent conditions by all Vendor
well i have create above condition i want to assing all this with the all vendor. ie custom duty must go to commissioner vendor, custom clearing charges must go to C & F agent. example particular condition type vendor basic duty
-
ORA-29855: erreur d'exécution de la routine ODCIINDEXCREATE
Hello i have an error when creating a full text index on a simple table which has a primary key CREATE TABLE tab_1(aa nvarchar2(50) PRIMARY KEY,bb clob) CREATE INDEX xtab_1_bb ON tab_1 (bb) INDEXTYPE IS CTXSYS.CONTEXT ORA-29855: erreur d'exécution de
-
My speaker no longer works on my iPhone 6
My speaker no longer works on my iPhone 6
-
Some functions not working in Acrobat Pro 08
For some reason lately when I try to apply a Header/Footer, or Watermark to a pdf document in Acrobat 8 pro the normal dialog box doesn't come up. Am I missing something??? My info: Mac OS X version 10.6.4 Build 10F569 Model Name: MacBook Pro Mode
-
TX2Z with Windows 7 stuck on "Preparing fo configure Windows"
Hi, New here and have the TX2Z for just 2 weeks. Boot up the laptop this morning and screen is stuck with this message of "Preparing to configure Windows. Do not turn off computer" . I though tried pressing ctrl + alt + del but nothing. Thanks i