Showing posts with label amount. Show all posts
Showing posts with label amount. Show all posts

Wednesday, March 7, 2012

how to calculate prior period with 52 weeks ?

I defined the calc for prior period for sales amount. But is it possible to get last 52 weeks from the current period?

how to define in this calc?

-- PRIOR PERIOD CALCULATIONS

([Time Calculations].[Prior Period]=

IIF(([Date].[Fiscal Hierarchy].currentmember.lag(1),

[Time Calculations].&[ Current Period])=0,null,

([Date].[Fiscal Hierarchy].currentmember.lag(1),

[Time Calculations].&[ Current Period]))

);

If your hierarchy has a week-level, then I believe what you are looking for is this:

Code Snippet

SET [Time Calculations].[Prior Period] AS 'LastPeriods( 52, [Date].[Fiscal Hierarchy].currentmember )

This gives you a set of the current week and the previous 52 weeks. Assuming [Date].[Fiscal Hierarchy].currentmember is at week-level.

Best regards

- Jens

how to calculate prior period with 52 weeks ?

I defined the calc for prior period for sales amount. But is it possible to get last 52 weeks from the current period?

how to define in this calc?

-- PRIOR PERIOD CALCULATIONS

([Time Calculations].[Prior Period]=

IIF(([Date].[Fiscal Hierarchy].currentmember.lag(1),

[Time Calculations].&[ Current Period])=0,null,

([Date].[Fiscal Hierarchy].currentmember.lag(1),

[Time Calculations].&[ Current Period]))

);

If your hierarchy has a week-level, then I believe what you are looking for is this:

Code Snippet

SET [Time Calculations].[Prior Period] AS 'LastPeriods( 52, [Date].[Fiscal Hierarchy].currentmember )

This gives you a set of the current week and the previous 52 weeks. Assuming [Date].[Fiscal Hierarchy].currentmember is at week-level.

Best regards

- Jens

Friday, February 24, 2012

how to build such a report with include unkown amount of subreports?

I have spent much time but still have no idea.
I need to dynamic create the report.especially the report (A) is made up of unknown amount of one composite report(B,which include serveral subreports).
An idea is to place subreports of B directly in A.

And the subreports include some tables(not the real table in database) which columns is not fixed.|||Put the SubReport under a Group instead of under a Page header, that way you will get a subreport each time you change groups.|||Would you please explain more detail?
And the other problem is that some tables(not the real table in database) which columns is not fixed.|||I'll try to explain in more detail, but I need to know more about what you're trying to do. What version of Crystal are you using, how are you building the report (using rpt files or RDC, etc...). Give me as much details as you can about what you have already done, what's not working, and what you're trying to do.|||My crystal reports' version is 9.2.

I dont mind using RDC or RPT.

For example there are 4 database tables name (The order information of garment)OrderStyle,ColorGroup,ClothSizeCode,OrderDetails
the sub reports is
sub report A
--------------
OrderCode | StyleCode | StyleName//In OrderStyle
--------------

sub report B
-------------------
|ColorGroupCode | S | M | L | XL | XXL | ...| Summary
|-----------------
|001 |1 |5 |1 | 5 | 9 | ...|21
|002 |1 |6 |2 | 6 |1 | ...|16
|.....................................................
-------------------
|summary |2 |11|3 |11 |10 | ...|37
------------------

The S,M,L,XL,XXL are come from table ClothSizeCode and which size is selected is decided by customer. I think that to use crosstab may be a good idea.
My problem is that how to fixed these 2 subreports in one report.
In power builder it is simple but the efficiency is so poor that it may take 2 minutes to get such a report with only 6 subreport A and 6 subreport B with a few rows.|||OK, here's my guess, tell me if it's close to what you need...

Group Header #1: Customer

... SubReport1:

... ... OrderCode | StyleCode | StyleName//In OrderStyle

... SubReport2:

... ... CrossTab with ClothSizeCode as column, ColorGroupCode as row, If you choose to display Totals, it will automatically summarize it for you

Group Footer #1

Remember that each Subreport is like a whole separate report, it doesn't have to be based on the exact same criteria as your main report. Put both SubReport1 and SubReport2 in the Group Header #1 section.