Weekly Group Total and associated YTD total
Hello,
I need to show current week group total and total year to date of the same group. My columns are Model, Department, Issue. Currently, the report is grouped on Model, Department and Issue with a filter for date. Can this be done? Thank you
Create a formula field, say {@Current Week Amount} as (basic syntax):
if datepart("ww", {datefield}) = datepart("ww", CurrentDate) then
formula = {amount}
else
formula = 0
end if
You can then sum() this, or place it in a detail line, or whatever. It will only have a (non-zero) value when the date field is in the current week.
HTH,
Carl
Similar Messages
-
Add and subtract summary group totals
Looking for a way to add and subtract summary group totals in a report.
I have my data grouped by account type then summarized. Example
have my data grouped by account type then summarized. Example
acct. type amount
51 $100
51 50
Summary $150
61 $100
61 100
Summary $200
70 $50
70 50
Summary $100
Formula I want to make this formula 51+61-70 = GP
I am trying to understand how to put the acct. type(51,61) in the formula and insert in the report.
Thanks for the help.
Raald232 -
Grouping totals by date ranges
Hi All,
I have an ASP.NET application, in which I have to get totals from a table using different criteria, which I do like this:
SELECT DISTINCT
SUM(CASE WHEN MYCONDITION1 THEN 1 ELSE 0 END) AS TOTAL1,
SUM(CASE WHEN MYCONDITION2 THEN 1 ELSE 0 END) AS TOTAL2
FROM TABLE1, TABLE2
WHERE COMMON_CONDITION1 AND COMMON_CONDITION2
AND BETWEEN DATE1 AND DATE2;
This works fine and I get the intended result.
Now, I have to repeat this for every week for the last 12 months, excluding holidays period. So, I generate a set of date ranges which will be used in the queries. So, I repeat the above sql statement for all the date ranges, which is a lengthy process.
I have to get the totals for every week. For example from 26-Sep-2010 to 02-Oct-2010, 19-Sep-2010 to 25-Sep-2010, 12-Sep-2010 to 18-Sep-2010, etc.. How should I put those ranges in the group by and select statement, because, I don't have them in a table.
How can I do that in a single shot and get all totals for each date range. Please help me with sql.
Thank you.
Edited by: 800729 on Oct 7, 2010 4:33 AMHi,
Welcome to the forum!
800729 wrote:
Hi All,
I have an ASP.NET application, in which I have to get totals from a table using different criteria, which I do like this:
SELECT DISTINCT
SUM(CASE WHEN MYCONDITION1 THEN 1 ELSE 0 END) AS TOTAL1,
SUM(CASE WHEN MYCONDITION2 THEN 1 ELSE 0 END) AS TOTAL2
FROM TABLE1, TABLE2
WHERE COMMON_CONDITION1 AND COMMON_CONDITION2
AND BETWEEN DATE1 AND DATE2;Does that really work? Don't you have to do something like
AND date_column BETWEEN DATE1 AND DATE2Post actual code, simplified if necessary, but still something that you can run.
This works fine and I get the intended result.
Now, I have to repeat this for every week for the last 12 months, excluding holidays period. So, I generate a set of date ranges which will be used in the queries. So, I repeat the above sql statement for all the date ranges, which is a lengthy process.
I have to get the totals for every week. For example from 26-Sep-2010 to 02-Oct-2010, 19-Sep-2010 to 25-Sep-2010, 12-Sep-2010 to 18-Sep-2010, etc.. How should I put those ranges in the group by and select statement, because, I don't have them in a table.Are you saying your current query produces 1 row, but you want something that has 53 rows, one for each week in the last year?
If so, add a "GROUP BY x" clause, as Sabnkar suggested, where x is a distinct value for each week.
You will probably *not" want to use TO_CHAR (date_column, 'WW'), especially if all of the output is not in the same calendar year.
If your weeks always begin on Sunday, then TRUNC (date_column, 'D') would be a better GROUP BY exptression, but it depeneds on your NLS settings.
GROUP BY TRUNC (date_column + 1, 'IW') - 1 will do the same thing, regardless of your NLS settings.
You may not need a table tha has one row per week, but if you do, Sauhik showed you how to generate a result set that will work just as well.
How can I do that in a single shot and get all totals for each date range. Please help me with sql.I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements) and the results you want from that data, as Saubhik requested.
Include examples of holidays: it's very unclear how you want to handle them. What is a "holday period"? How do you know if a given date is in one or not?
Simplify the problem as much as possible. For example, post a problem that gets the last 3 weeks, instead of the last 53 weeks. Anyone who suggests a solution will show you how to change it for 53 weeks, if necessary. -
Group Totals Not Calculating Correctly P6 7.0 SP 4.0
Hi there,
For no reason I can tell, my schedule has suddenly started showing Group Totals in my layout that do not add up correctly, although the activity durations are correct.
From past experience this is usually a calendar issue. I am using a Project Calendar, and the Hours per Time Period checkbox to use assigned calendar is ticked. I am using a 11hr / Day, 7 day a week calendar. Upon looking into the Global calendars, a 38hr week calendar is clicked as a default. Could this be causing the issue? I have done some calculations and it appears that some of the totals are being calculated on a 38hr week, but not in every case.
I know the Global calendar issue was a problem in V6.0 but I was under the impression that the Project Calendar would overide in v7.0. is this the case?
Is there something else I may be missing? The only major work that has been done recently is a colleague removed all the WBS Summary activities from the schedule.
Can anyone provide any way forward?
With Regards,Hi there,
For no reason I can tell, my schedule has suddenly started showing Group Totals in my layout that do not add up correctly, although the activity durations are correct.
From past experience this is usually a calendar issue. I am using a Project Calendar, and the Hours per Time Period checkbox to use assigned calendar is ticked. I am using a 11hr / Day, 7 day a week calendar. Upon looking into the Global calendars, a 38hr week calendar is clicked as a default. Could this be causing the issue? I have done some calculations and it appears that some of the totals are being calculated on a 38hr week, but not in every case.
I know the Global calendar issue was a problem in V6.0 but I was under the impression that the Project Calendar would overide in v7.0. is this the case?
Is there something else I may be missing? The only major work that has been done recently is a colleague removed all the WBS Summary activities from the schedule.
Can anyone provide any way forward?
With Regards, -
I have a report and the thing is when i try to get totals i am getting it wrong for a particular group as it is taking the total of the previous group also and adding it to it.
group1
total1
group2
total2
group3
total3
TOTAL of all groups total4
the above is the desired result but i'm getting as
group1
total1
group2
total2
group3
total3 ------>(This is picking up the total of all thea bove groups total1 + total2 + total3)
TOTAL of all groups total4----> This is again correctThanq once again Kavipriya it works like a charm/
Regards,
Solly -
Hi,
I have sql query which gives output of accounts and balance.
I have designed report to show chart of accounts and their balances.
How can I take group total fields to show sum of each level of accounts.
Level
Account
Header 3
Header 4
Header 5
Header 6
Header 7
1
Revenue
2300
2
Direct Income
300
3
Sales
300
4
Sales
300
5
In Store Sales
100
5
Online Sales
200
2
Indirect Income
2000
3
Interest
1100
4
Bank Interest
1100
5
Bank Interest A
400
5
Bank Interest B
700
3
Other Income
900
4
Other Income
900
5
Other Income
900
In my reports I have taken all the accounts and balances in five detail sections.
I want to create formula to show level wise addition of account balances.
Please reply.Thanks.Hi,
Try this code
{Level}=1 then {Header 3}
else if {Level}=2 then {Header 4}
else if {Level}=3 then {Header 5}
else if {Level}=4 then {Header 6}
else if {Level}=5 then {Header 7} -
How to get the group totals in report
HI,
Iam generating a report to display Storage Location, and Unit of Measures and Material group and also group totals.
how to display the group totals on the report.
thank q
rushi.Hi,
This following report clearly explains how to display the subtotal and grand total of
the particular field in alv.
REPORT YMS_ALVSUBTOTAL.
*REPORT z_alv_sub_totals .
TYPE-POOLS: slis.
DATA: BEGIN OF it_output OCCURS 0,
var1(8) TYPE n,
var2(10),
var3 TYPE I,
END OF it_output.
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
t_fieldcat TYPE slis_fieldcat_alv,
it_sort TYPE slis_t_sortinfo_alv,
t_sort TYPE slis_sortinfo_alv,
v_repid LIKE sy-repid.
INITIALIZATION.
v_repid = sy-repid.
START-OF-SELECTION.
PERFORM get_data.
PERFORM sort_fields.
PERFORM fill_fieldcat.
PERFORM list_display.
*& Form GET_DATA
text
--> p1 text
<-- p2 text
FORM get_data.
it_output-var1 = 1000.
it_output-var2 = 'anupama'.
it_output-var3 = '10000'.
it_output-key = 'X'.
APPEND it_output.
CLEAR it_output.
it_output-var1 = 1000.
it_output-var2 = 'siddhu'.
it_output-var3 = '20000'.
APPEND it_output.
CLEAR it_output.
it_output-var1 = 1000.
it_output-var2 = 'chinni'.
it_output-var3 = '100000'.
APPEND it_output.
CLEAR it_output.
it_output-var1 = 2000.
it_output-var2 = 'chicchu'.
it_output-var3 = '10000'.
APPEND it_output.
CLEAR it_output.
it_output-var1 = 2000.
it_output-var2 = 'candy'.
it_output-var3 = '10000'.
APPEND it_output.
CLEAR it_output.
it_output-var1 = 1000.
it_output-var2 = 'anupama'.
it_output-var3 = '10000'.
APPEND it_output.
CLEAR it_output.
it_output-var1 = 4000.
it_output-var2 = 'anupama'.
it_output-var3 = '10000'.
APPEND it_output.
CLEAR it_output.
ENDFORM. " GET_DATA
*& Form fill_fieldcat
text
--> p1 text
<-- p2 text
FORM fill_fieldcat.
PERFORM fill_fields USING: 'IT_OUTPUT' 'VAR1' 'Variable 1' ' ',
'IT_OUTPUT' 'VAR2' 'Variable 2' ' ',
'IT_OUTPUT' 'VAR3' 'Variable 3' 'X'.
ENDFORM. " fill_fieldcat
*& Form fill_fields
text
-->P_0146 text
-->P_0147 text
-->P_0148 text
-->P_0149 text
FORM fill_fields USING value(tabname) TYPE slis_tabname
value(fieldname) TYPE slis_fieldname
value(seltext_m) LIKE dd03p-scrtext_m
value(do_sum) TYPE c.
t_fieldcat-tabname = tabname.
t_fieldcat-fieldname = fieldname.
t_fieldcat-seltext_m = seltext_m.
IF do_sum = 'X'.
t_fieldcat-datatype = 'CURR'.
ENDIF.
t_fieldcat-do_sum = do_sum.
APPEND t_fieldcat TO it_fieldcat.
CLEAR t_fieldcat.
ENDFORM. " fill_fields
*& Form list_display
text
--> p1 text
<-- p2 text
FORM list_display.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = v_repid
it_fieldcat = it_fieldcat
it_sort = it_sort[]
TABLES
t_outtab = it_output
EXCEPTIONS
program_error = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " list_display
*& Form sort_fields
text
--> p1 text
<-- p2 text
FORM sort_fields.
t_sort-fieldname = 'VAR1'.
t_sort-tabname = 'IT_OUTPUT'.
t_sort-spos = 1.
t_sort-up = 'X'.
t_sort-subtot = 'X'.
APPEND t_sort TO it_sort.
CLEAR t_sort.
t_sort-fieldname = 'VAR3'.
t_sort-tabname = 'IT_OUTPUT'.
t_sort-spos = 2.
t_sort-up = 'X'.
APPEND t_sort TO it_sort.
CLEAR t_sort.
ENDFORM. " sort_fields
Thanks,
Sankar M -
Incrementing Total not correct(adding +1) in some group totals
Hi All,
I have an incrementing total that appears to work fine except when I try to display the total's final count only SOME groups have a +1 count. There doesn't seem to be a logical reason for it.
Any ideas?
Incrementing total formula:
Whileprintingrecords;
if Not({Command.BI_UPD_DT_TM} > {@f_ConvertRevYrMo_DtTm})
then
Global numbervar memberlinecnt := memberlinecnt +1
else
memberlinecnt+0;
Formula to call incrementing total's final group total:
Global numbervar memberlinecnt:={@f_RRTMemberIncrement};
memberlinecnt;
Note: I've not been able to use Running Total fields with this report because I need to evaluate totals based on group criteria and there are multiple groups and criteria.Hi Sharon,
I do have a reset, just didn't include it in my post.
Reset
//@Reset (Place this in the group header section suppressed)
WhilePrintingRecords;
Global NumberVar memberlinecnt:= 0;
Like I said,the whole thing appears to work, counting for ever group, resetting; except for only some groups, the total is +1 of the total. I don't know why.
Thanks,
John -
Help with Formula/Placeholder columns for group totals
I have select that is broken into 2 groups (a COMPANY group and a DETAIL group within company). I need to determine the COMPANY group totals based on values in a column in the DETAIL group. I.E. the column is a transaction description and can have up to 15 different values and it did not appear that a summary column would work for what I need. I have currently set up 15 formula columns in the DETAIL group and check the value of the REASON to accumulate totals and return the total to a PLACEHOLDER column (which is numeric and defined in the COMPANY group).
I then report the Placeholder columns at break of COMPANY. This all works fine if I run only one company. If I run with multiple companies the Placeholder columns are used as a running total.
My question is how do I reset the PLACEHOLDER columns at company break if at all, or is there a simpler way to accomplish what I need.
Any and all assistance would be greatly appreciated.
Tom VereeckeIf you are using one placeholder column in different formula columns just ignore the following solution. It will not work in that case. I will post it here if i find out any way to initialize placeholder columns at different groups or anyother way to solve this issue.
I think if you remove placeholder columns and create summary columns at Company Level, that will work. And formula columns will be changed as follows:
Formula Column:
active_total number(10) := 0;
begin
if :status_1 = 'ACTIVE' then
active_total := active_total + 1;
end if;
if :status_2 = 'ACTIVE' then
active_total := active_total + 1;
end if;
if :status_3 = 'ACTIVE' then
active_total := active_total + 1;
end if;
return active_total;
end;
And in summary columns source will be formula columns. And reset the summary columns at Company.
Hope this helps.
Message was edited by:
fs -
Group totals summary in another group summary section
I have a report requirements that need to re-display the group total in a summary section. Please see below simple example. The second summary does not have fixed number of Units, it depends how many units are in each Department.
I am not able to reproduce the department summary. Is this possible in SSRS, I can do this in crystal?
Example:
Department ABC Unit 100
details line here....
Unit 100 totals here
Unit 120
details line here.....
Unit 120 totals here
Unit 140.......
Department ABC summary
Unit 100 total
Unit 120 total
Unit 140 total
Department XYZ
Unit .................
Department XYZ summary
unit totals.................... (one to many)
Final Summary
Department ABC total
Department XYZ total
Jim PanHi Jim,
In your case, we can work around the issue in SSRS. Suppose we have a dataset (DataSet1) include following fields: Department, Unit, Amount. Please refer to the following steps:
Add a table in the report body. Please refer to the table structure below:
Parent Group: Department
Child Group: Unit
Data: Amount
Click the blank arrow of (Details) in the Row Groups dialog box. Click Add Total.
Use the same method add total to the Unit and Department group.
There is a screenshot for your reference:
If you have any questions, please feel free to let me know.
Regards,
Alisa Tang
Alisa Tang
TechNet Community Support -
Urgent : how I get tree type group total result
hi master
sir now system give me this type for result
PARENT ACCID DRBAL CRBAL
K1
K11
11 K1101 46291132
11 K1102 13182173
11 K1103 23784045
11 K1104
11 K1105
11 K1106
11 K1107 10001795
11 K1108 9083529
11 K1109
11 K1110 4224350
11 K1111
11 K1112 6696832
11 K1113 7963381
11 K1114 742766
1 K12
12 K1201 1486082
12 K1202
12 K1203
1 K13
13 K1301
1301 K130101
1301 K130102
1301 K130103
1301 K130104 1977616
1301 K130105
1301 K130106 736266
1301 K130107 396673
1301 K130108 42751
1301 K130109 298362
1301 K130110 187696
1301 K130111 537
1301 K130112 942
1301 K130113 987
1301 K130114 1272
1301 K130115 40000
13 K1302
1302 K130201
1302 K130202
1302 K130203
1302 K130204
1302 K130205 259941
13 K1303
1303 K130301
1303 K130302
1303 K130303 177716
13 K1304
1304 K130401
1304 K130402
1304 K130403
1304 K130404
1304 K130405
1304 K130406 809719
1304 K130407
1304 K130408 1786091
13 K1305
1305 K130501
1305 K130502
13 K1306
1306 K130601
13 K1311
1311 K131101 788780
K2
2 K21
21 K2101
2101 K210101
2101 K210104
21 K2102
2102 K210201
2102 K210202
22 K2205
2205 K220501
2205 K220502
220502 K22050201
220502 K22050202
220502 K22050203
220502 K22050204
22 K2206
2206 K220601
2206 K220602
but sir i need this type of result
PARENT ACCID DRBAL CRBAL
GROUP NAME K1
GROUP NAME K11
11 K1101 46291132
11 K1102 13182173
11 K1103 23784045
11 K1104
11 K1105
11 K1106
11 K1107 10001795
11 K1108 9083529
11 K1109
11 K1110 4224350
11 K1111
11 K1112 6696832
11 K1113 7963381
11 K1114 742766
TOTAL
1 K12
TOTAL
GROUP NAME
12 K1201 1486082
12 K1202
12 K1203
TOTAL
1 K13
13 K1301
1301 K130101
1301 K130102
1301 K130103
1301 K130104 1977616
1301 K130105
1301 K130106 736266
1301 K130107 396673
1301 K130108 42751
1301 K130109 298362
1301 K130110 187696
1301 K130111 537
1301 K130112 942
1301 K130113 987
1301 K130114 1272
1301 K130115 40000
13 K1302
1302 K130201
1302 K130202
1302 K130203
1302 K130204
1302 K130205 259941
13 K1303
1303 K130301
1303 K130302
1303 K130303 177716
13 K1304
1304 K130401
1304 K130402
1304 K130403
1304 K130404
1304 K130405
1304 K130406 809719
1304 K130407
1304 K130408 1786091
13 K1305
1305 K130501
1305 K130502
13 K1306
Sir I need total group by group father group total and child group total
Please help me how I get tree type group total resultHi master
thankyou for your reply
Sir,
i know and you see my working i get code form master table and get detal amount form other table
I have two table see table
Acctab Baltab
PARENT PCID
CHILD title
PCID amount
I need heretical result use this type of query but not success
please see my query and give me idea how I get here full tree
select test.child,test.pcid,baltab.pcid from (select acctab.child,acctab.parent,acctab.pcid
from acctab
start with acctab.parent is null
connect by prior acctab.child= acctab.parent) test,baltab
where test.pcid=baltab.pcid ;
CHILD PCID PCID
1 1 1
2 2 2
3 3 3
11 111 111
12 112 112
13 113 113
21 221 221
22 222 222
23 223 223
31 331 331
32 332 332
33 333 333
but I need this type result
CHILD PCID
1 1
11 111
12 112
13 113
2 2
21 221
22 222
23 223
3 3
31 331
32 332
33 333 -
Group total amount in body margin
I have a group total amount and remark fields placed in the body margin. All the fields are inside a frame, which is set to "All Pages". And all the fields is set to "First Page".
My expected result is that the content will only show at the end of each group. But the fact is that, though they are all using "First Page", but the group total amount appears on every pages while the remark fields work!
Any idea? Thanks!the group total (and remark fields?) should be in a frame outside the grouping frame, not the margin.
-
hi
i have a matrix report with 2 level groups above it. now i need to sum group 2 cloumn values for every row on the basis of level 1 group.
For example, I have Top level group like TUBEWELL TYPE ( values are DEISEL and ELECTRIC) and below it at lower level is OWNER (with values like PRIVATE, GOVT) repeating both for DEISEL and ELECTRIC.
Now I need to sum every row i.e Private and Govt for Diesel and Private and Govt for Electric (two sums in one row).
Wizard provides complete row total but not group total.
So ur help required guys!!
nadeem ameer
[email protected]Hi..
am not providing you the exact answer.
But you can refer to the PRODUCT ORDER PROPERTY in the reports help or on the website.
Basically, all you need to do is manipulate the product order property, reset at or may be even compute at properties in the summary/ formula column of your matrix report.
Swati -
Org. unit and associated material groups download from Org. structure
Hi,
I want to download the material groups and associated material groups(Defined in External attributes) from organisation structure.
Please suggest how to do it.
Best regards,
SambitHi. There's a point. You said you wanted to download a list so I presumed you wanted all the org units and all the material groups assigned to them.
If you only want to do it 1 org unit at a time the function will work perfectly.
I f you do want to see all I have had another thought actually.
You could run program RHOMATTRIBUTES_REPLACE.
This allows you to replace 1 attribute with another, but if you do not press the "change" button it works as a good report on attributes.
If you just put in attibute PRCAT and then Old Value = Logical System of backend and New Value = Logical system of backend and tick substring then execute, it will show you all the org units and all the material groups.
Just be careful not to press the replace button on the output, that would actually change data.
Regards,
Dave. -
SQL Script - PO/PR Approval Groups and associated Positions and holders
Hi,
Does any one has SQL to list down - PO/PR Approval Groups and associated Positions and holders?
RgdsIf you are looking for verifiing the approval groups, you can use the approval diagnostics; that has most of these sqls.
Maybe you are looking for
-
Error while trying to use Ant and creating Jdbc Datasource
I was following the documentation to auto-create my datasource in my weblogic server. I get an error while it is trying to link the datasource to the server. Does anybody have any ideas,it is almost like the query to get the server isn't working. Her
-
Not able to link more than one EO to the VO.
Hi All, I have to add a new column from another table to the existing VO. I have followed the below steps. Step1: I have created a new EO for the new table Step2: I have created a new VO which extends the existing VO. Step3: While extending the new V
-
ALV Grid - Printnig field names.
Hi Gurus, I have a requirement for a report which has the format for display as shown below. Sr. No | Mat No. | Material grp | some material types | COLUMN HEADINGS |*********|*************** | 10g | 20g | 30g | 40g | COLUMN HEADINGS 000001 |xyz****
-
Don't understand error message from HTML parser?
I've written a simple test program to parse a simple html file. Everything works fine accept for the <img src="test.gif"> tag. It understands the img tag and the handleSimpleTag gets called. I can even pick out the src attribute. But I get a very str
-
Currency input data for Vendor Master
Hi When I make a PO (me21n), the Currency data is missing. From where do we get the Currency data - from Vendor Master or the Material Master ? Thanks in advance Vaidee