Measures based on the number
I would like to know the total number of counts in a table based on a condition (sex = 'F' or me ""), can I do this in SQL.I will model a simple MDB layer to create two measures 1. Male County 2. The female County; but do not know how to proceed.
Here are the queries:
1. Select post_code, count (gender) AS MALE_COUNT from balances_f where sex = am' post_code group;
2. Select post_code, count (gender) AS FEMALE_COUNT from balances_f where sex = 'F' group by post_code;
Appreciate any help.
Thank you
B
Hi create two columns in MDB layer with the formula as
-case when sex = M then 1 else 0 end
and
-case when sex = F then 1 else 0 end
In the aggregation make as sum. use it in your report. you will get what you want.
Tags: Business Intelligence
Similar Questions
-
Calculate fees that pay based on the number of days in a month
Hello
I'm writing the BR to fresh wages, based on the number of days in the month.
Fix(Jan:DEC)
"Salary" = ("Annual salary"-> "BegBalance" / 12) * "workforce";
The existing calculation was ' wages divided by months no .of (12) ", now instead of number months wages that need to be calculated ("BegBalance"/ No..) OF DAYS IN THE MONTH) * 12.
Can someone pls guide me, how to begin writing the BR for 'No. DAYS OF THE MONTH.
You can do an admin enter number of days in the month. I remember CL reminding me the rhyme thirty days has September - Wikipedia, the free encyclopedia
Jokes aside, you can use SQL to get the number of days. You will get different options for SQL and Oracle.
If you want to continue to do this in BR then
Fix(Jan:DEC)
IF (@ISMBR (SEP) OR @ISMBR (Apr) OR @ISMBR (Jun) OR @ISMBR (Nov))
("Salary" = ("annual salary"-> "BegBalance" / 30) * 12) * "workforce";
ELSEIF (@ISMBR (Jan) OR @ISMBR (Mar) OR @ISMBR (May) OR @ISMBR (July) OR @ISMBR (Aug))
("Salary" = ("annual salary"-> "BegBalance" / 31) * 12) * "workforce";
ELSE (@ISMBR (Feb))
IF (@Remainder($CurrYr/4) == 0)
("Salary" = ("annual salary"-> "BegBalance" / 29) * 12) * "workforce";
ON THE OTHER
("Salary" = ("annual salary"-> "BegBalance" / 28) * 12) * "workforce";
ENDIF
ENDIF
ENDFIX
Concerning
Celvin
Post edited by: CelvinKattookaran
-
divide the table based on the number of lines
Hello
I am trying to split a table based on the number of lines and then treat.
Say I have a TEST_XXX table that contains 50 lines, what I would do is.
to access multiple lines of 10. How can we achieve this?
What I thought is, once the table is created and the line are filled.
Add a new column to the table and perform a procedure that inserts of 1 to 10 first lines
and 2 to 10 lines and 3 to 10 next ranks... etc. Based on this, that we can treat
the first set of lines then play next or etc...
is there a better way to do it?
Code to create the table:
Code to add lines:CREATE TABLE TEST_XXX ( A_ID VARCHAR2(10), B_ID NUMBER, c_ID VARCHAR2(10), D_ID NUMBER )
The original problem is, I have a huge table, and I write a sql query to process,DECLARE BEGIN FOR I IN 1..50 LOOP INSERT INTO TEST_XXX VALUES('ABCDE',123,'ZYXWV',321); END LOOP; COMMIT; END;
When I treat him by selecting all the values in the table, it is very slow.
But when I have treat small Coulon (say 100 rows), it works very well.
That's how I got the approach described above in mind.You can use NTILE.
See:
http://download.Oracle.com/docs/CD/B19306_01/server.102/b14200/functions101.htm#SQLRF00680
http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:47910227585839 -
How to search for an image Adobe Stock based on the number of files Adobe Stock?
Before I signed up for Adobe Stock, I took screenshots of the pictures that I wanted to buy. These plans include the official file Adobe Stock number. Now that I have a subscription, I want to buy these images. But it doesn't seem to be an option to search based on the file number. How can I get the image I want, by file number, without wasting hours of research of individual images through keywords?
Simply type the Stock number in the search. Be sure to have audited as well appropriate file types.
-
Basic conditional script based on the number of lines in a text layer?
Just received help here to write a conditional script by using the font size of a text layer. Thank you all for this.
The next hurdle is a conditional script using the number of lines in a text layer in the differential. Far as I can tell it not the layer details which specify the number of lines. Just '\r' for a return in the idTxt descriptor. Nothing seems to stand for a soft return as far as I can tell. I'll probably have to be able to count the lines with soft and hard returns.
Any thoughts?
I was playing around with this a bit and here is a small script to determine the number of rows. This is based on the self in the head, that I calculated to environ.108 times the size of the font.
#target photoshop app.preferences.rulerUnits = Units.POINTS; var doc = activeDocument var tL = doc.activeLayer var h = tL.bounds[3]-tL.bounds[1] var per = ((h/5)-(tL.textItem.size))/tL.textItem.size var num = h/(tL.textItem.size *1.108) alert(Math.round( num))
-
Commission on track based on the number of sales
I got a new job (yay!) and I'm trying to follow my commissions. I am paid by a combination of production and the number of sales that I produce. Here is a small picture to show what I mean.
Number of sales
Payout rate
1
6%
2
7%
3
8%
4
9%
5
10%
6
11%
7
12%
8
13%
Let's say that each sale, the customer pays $2,000 to keep things simple. The first sale, I would win $120, the second sale I now would get $140 for each because it is retroactive (does sense?) without the hat. How would actually follow it in numbers? Thanks in advance!
This may work for you:
the first line of the two tables is a header row
them 4 last lines of the table 'sales' on the right are the lines of footer
(The first line of the footer) B8 contains the formula:
= SUM (B)
shorthand is
B8 = SUM (B)
B9 = MIN (COUNTA (A), COUNTA (B))
B10 = VLOOKUP (B9, sales bonus::A:B, 2, 0)
B11 = B8 × B10
-
Formula need to count cells based on the number of week
I have a table used to track dates of contact with a client. A column calculates the WEEKNUM of the date of contact.
Week NUM
Date
First name
2
04/01/2016
Amanda
3
16/01/2016
Robert
4
17/01/2016
Rosie
6
01/02/2016
John
6
02/02/2016
Soledad
9
21/02/2016
Charles
9
24/02/2016
Mary
9
25/02/2016
Quince
12
17/03/2016
Bob
12
17/03/2016
Donald
14
03/31/2016
Cathy
14
01/04/2016
Shanna
19
02/05/2016
Laura
I need to report the number of contacts per week, so I mounted a second table with the week number in the first column. Each line corresponds to the number of week. I'm trying to use the function of COUNTIES to count the number of contacts in which the number of the week of the first table is equal to the week of the second table, but I can't get it to work. Is there a way to do this?
Week NUM
Number of contacts
expected outcome of the formula
1
0
2
1
3
1
4
1
5
0
6
2
7
0
8
0
9
3
10
0
11
0
12
2
13
0
14
2
15
0
16
0
17
0
18
0
19
1
20
0
Never mind. I'm a fool. COUNTIF does it, and I'm stuck trying to make COUNTIF work.
-
Move and organize files based on the number of lines
Hello
I have a directory containing files nearly 1,500, some of which are composed of 12 lines, some of which are composed of 4 lines, which are all .phy (PHYLIP) files, which can be viewed in Notepad/wordpad as text files.
I need to execute a script which will determine the number of lines in each file and move them to the corresponding folder. The file size will not work for sorting, I've tried.
that is, all files with 4 lines in one folder, all the files with 12 lines in another folder, any files left (so I can be sure that everything has been inspected) in the main directory.
Can anyone help?
Thank you
This issue is beyond the scope of this site and must be placed on Technet or MSDN
-
How to add a certain number of instances based on the number selected in a drop-down
I have a form where I would like users to select a number from a drop down, and the number of instances of a specific subform are displayed, for example if they choose 3 from the menu drop-down, 3 cases of the display of subform. I am a newbie of LiveCycle, if anyone can help me with a simple way to do this?
When a line is hidden when the form is created and you add instances of this line, it will add these lines as hidden because it uses the original properties of the line.
You would have to set all the rows that have been added to visible when they are created.
Subform1.instanceManager.setInstances (5);
for (var i = 0; i)< subform1.instancemanager.count;="">
var frmSub = Main.resolveNode ("subform1 [" + I.ToString + "]");
frmSub.presence = "visible";
}
-
Automating the validation based on the number of rows updated
Hello
Is it possible that I can, in a SQL script, restore or commit a transaction according to the number of lines have been updated?
We often receive requests for corrections of data in DBs and then must post manually, but only if the number of lines is what the developer has specified.
1 tab1 update
2. If the number of rows updated = 50, validation
3 if not, roll back
Thank you
AndreasTry this
update of tab1 set col1 = 80;
If rowcount sql = 50% then
commit;
on the other
rolback;
end if;
.... -
Shaved measure based on the month level.
Hello
I defined a shaved measure at the "level of months."
I expect to have an aggregate to the month level in the year.
But there is evidence of aggregation of the month irrelevant year-round. For example in the data of four years, for the month of August, it shows the aggregation of the Aug-2010, 2009, 2008 and 2007.
How can I get monthly globalization at the month-year level?
The time dimension and hierarchy are based standard time dimension OWB.
Thank you
~ AshWhat is the feature of level key column for months in your time dimension?
It should be of format YYYYMM, but not just mm...
-
The customer States AR indicate Page numbers Reset based on the number of customer
Hello
In the customer statements AR report, if I ran the report for several clients, page number must be reset for each customer...
Group on the way as below,
<? for-each-group: G_STATEMENT; STATEMENT_DATE? > <? for-each - group:current-group(); SEND_TO_ADDRESS_ID? >
Hi Valerie,.
I got the answer by using the @section command.
Here's the complete syntax in my case.
Xml tag - field form
If the found data.
Group G_SETUP-
Group G_STATEMENT-
Its work for me.
Let me know if you need more information.
Kind regards
National Stadium
-
Dynamic LOV based on the number
I paint a blank on this one, but I am trying to create a dynamic LOV to a selection list where a user can select a number from 1 to the quantity of an item.
(ie. count (asset_id) where asset_type =: PAGE_ITEM would be the maximum of the selection list)Hello
What about...
SELECT LEVEL d, LEVEL r FROM dual CONNECT BY LEVEL < = ( SELECT COUNT(asset_id) FROM your_table WHERE asset_type = :PAGE_ITEM );
?
See you soon
Ben
Published by: Munky on Sep 30, 2010 15:19 - added display and return the value for the purposes of the LOV
-
Roll back or validation based on the number of deleted rows
Hello
I have a procedure that deletes rows from the table dummy1. The requirement now is if the delete query deletes several lines then it must be restored to commit on the other.
Note: the VALUE of the column in the table dummy1 isn't a primary column.
CREATE OR REPLACE PROCEDURE P_DELETE_CHECK AS
V_VALUE NUMBER;
V_TABLE_NAME VARCHAR (100);
BEGIN
RUN IMMEDIATELY 'REMOVE'. V_TABLE_NAME | "WHERE THE VALUE OF ('|) V_VALUE |') ' ;
END P_DELETE_CHECK;
Can someone help me on this.
Thank you
Mahesh.try to use this code snippet after your immediate execution:
if sql%rowcount > 1 then rollback; else commit; end if;
Edited by: hartmutm the 29.09.2010 04:50
-
based on the number of words get
Hello friends...
is there a function after I have can get number of words.
SELECT function_name ('HELLO WORLD')
OF THE NIS. Double
years = 2
Thank you...Hello
You can use this SQL query:
SELECT length('Hello World') - length(replace('Hello World',' ','')) + 1 FROM dual;
Thank you
Ankur
Maybe you are looking for
-
updated ipad 2 with ios 9.3.2 and killed my ipad
I have a 2 32GB ipad I downloaded update of Ios9.3.2 and could not get my ipad turns on for I have had with your last update Ios 9.3.1 simaler problem and had to take the ipad at best buy and completely recharge, 8 to 10 hours
-
Microsoft Surface 8.1 RT
I fight to locate a compatible driver for my printer HP Photosmart C5180 - even just a basic driver - my Microsoft surface 8.1RT. Has anyone successfully achieved this... ?? If so would like to know how! Thank you
-
Hi all I installed Windows 7 Ultimate SP1 on my daughters computer and everything works well except that when I try to connect to the router says the Ethernet driver is missing. When I Check Device Manager it shoes the Ethernet controller driver is m
-
Using existing Windows 7 on the new PC laptop to win 8
Hello. I don't know if I can do it. I'm going to need a new laptop soon but I don't want nothing with earn 8 or 8.1 to win. I just want to keep Win 7 that works very well for me. I have a new OS is unnecessary and won't spend the time to learn one. I
-
How can I know my complete information SYSTEM and download the drivers from hp website.