Crystal reports foreach loop in the formula field - crystal-reports-2008

Please help me to get the count of profile Ids foreach category in crystal report formula field.
I need to display Like : 2 people registered for Electrical Category
This my Sql Query result in the report.
ProID CATID Description
1 2 Inspection
1 4 Fabric Maintenance
1 6 Electrical
1 10 General Qualifications
3 6 Electrical
3 10 General Qualifications
4 1 QA /QC Vendor Inspection
6 1 QA /QC Vendor Inspection
11 1 QA /QC Vendor Inspection
12 1 QA /QC Vendor Inspection
12 2 Inspection
12 3 Coatings Inspection
12 10 General Qualifications
Thanks in advance

First you have to create a new group for category and you can use a sum(,) to solve the above requirement
http://answers.yahoo.com/question/index?qid=20080918181105AAsqVoC
http://social.msdn.microsoft.com/Forums/en-US/vscrystalreports/thread/9da5e3fb-a2ea-4337-b098-33f2b142fd0c/
Conditional group SUM in Crystal Reports

Related

How to deal with reporting slowly changing dimensions

For a client I am creating a data warehouse in which we have some slowly changing dimensions (or facts if that is even a thing?). For example we want to report the annually recurring revenue (ARR) for subscriptions and we want to have both the currently active and the expired subscriptions in there. So that we can see the ARR over a timeline.
The data we retrieve looks like this:
subscription_id
account_id
ARR
start_date
end_date
1
1
10
01-01-2022
31-03-2022
2
2
20
01-01-2022
31-12-2022
3
1
5
01-04-2022
31-11-2022
So in this case the same account (account_id 1) renewed a subscription at the 01-04-2022. In the report of 2022 we want to see the ARR for all months in 2022. I've looked into slowly changing dimensions, however something I can not really see in that concept is how to report both the currently active license and the history in a dashboard. If we for example want to visualize the ARR in all of 2022 per month in a dashboarding tool we want to see both subscriptions for account_id 1 over the course of the year, not just the currently active one. This seems to be very tricky to do in most dashboarding tools.
To overcome this I've done the following. I created a calendar table with an interval of 1 month and I cross join it with the table above to generate a fact table. The end result would look like:
timestamp
account_id
ARR
01-01-2022
1
10
01-01-2022
2
20
01-02-2022
1
10
...
...
...
01-11-2022
1
10
01-11-2022
2
20
01-11-2022
2
20
This makes it really easy for the user of the reporting tool to filter on a specific month and show the ARR between the dates and over multiple subscriptions. It does however generate a lot of extra data, but at the moment the storage space is not an issue. And it makes it more of a transactional style table, but the ARR is not really a transaction (i.e. it is not really a sold product on a specific date).
My question is: Are there better ways of generating a fact table where the source data contains a date range?

Finding mutually exclusive data to fulfill multiple criteria

I am trying to figure out an algorithm which would allow me to programmatically resolve the following problem.
There is a book club that has a set of rules for permission to join. You must have read 3 separate books which each conform to at least one of the following rules. All 3 rule criteria must be fulfilled by a separate book. Those rules are as follows:
Rules:
id
field
comparator
value
1
Author
IN
["John Steinbeck", "J.D. Salinger"]
2
Rating
>=
4.0
3
Number of Pages
>
300
The following is the list of books a user has read thus far:
Books:
id
title
author
rating
pages
1
Of Mice and Men
John Steinbeck
3.88
107
2
To Kill a Mockingbird
Harper Lee
4.28
281
3
Animal Farm
George Orwell
3.96
112
4
The Grapes of Wrath
John Steinbeck
3.98
464
5
1984
George Orwell
4.19
328
6
The Catcher in the Rye
J.D. Salinger
3.81
277
I've written a function which can allow me to check one specific rule with one specific book to return a boolean response indicating whether that book satisfies a given rule. The function is has the following signature
function is_valid(rule, book)
However, by running each book against each list of rules, I come up with the following list of books which match each rule:
rule_id
book_id
1
1
1
4
1
6
2
2
2
5
3
4
3
5
3
6
Now by manually looking through the resulting list of matching rules & books, I can tell that one of the combinations that would work is:
rule_id
book_id
1
1
2
2
3
4
Therefore the user who had read these 6 books would qualify to join the book club because they had read 3 separate books to satisfy each of the 3 rules.
What I'm hoping to find here is someone with expertise in data analysis that can help point me in the direction of an algorithm which can help me solve this problem programatically and allow me to scale this problem with many more rules and books that number in the tens of thousands potentially.
Any guidance would be greatly appreciated.

Transition matrix in Tableau

I want to create a transition matrix in tableau with the following data as example.
IDKEY Status Date
A 1 2013
B 1 2013
C 2 2013
D 1 2013
A 1 2014
B 1 2014
C 1 2014
D 2 2014
From this data I want to build a simple matrix. Rows are Current Status and Columns are Previous status. [1,2] means for example: 33%(C) of the ID's which have a current status of
1 had a previous status of 2. And the ID with a current status of 2(D) had a previous status of 1.
[,1] [,2]
[1,]0.67 0.33
[2,]1 0
Any ideas on this? I tried several calculated fields but they do not seem to work.
For additional information, see the attached screenshot.
Loan A&B remain 3 during 2014. I want to give those loans a value like "33" and loan
I goes from 1 to 2 and I want that loan to get a value "12". For example in a new column.
This example is with more levels than the first one.
Just bumped into this. And wrote a note on the solution for this exact problem.
http://vizdiff.blogspot.com/2016/10/creating-markov-chain-transition-matrix.html
The calculation in Tableau is actually very easy. We just need to compute the row totals along the new states. One can use Either window_sum() or LOD the level of details. See the details in the above article.
Sum({Fixed Year13: Sum(Number of Records)}) or Window_Sum(Sum(Number of Records)) computing using Year14.
See if this answer after 2 years works for you.

How to create crystal report to list parent and child records?

i'm using linq to sql in .Net 2010 project, i'm preparing the data in a list to load the data in the rpt file.
the parent table (passport):
ID name passport_number
1 Donnie 123456
2 Monica 789797
3 John 587123
The child table (passport_addons):
ID parent_id addon_name
1 2 Bob
2 2 Beverly
I want the rpt file to show the list of all the passport, and the passport_addons records below them if exists, for example:
ID NAME PASSPORT NUMBER
1 Donnie 123456
2 Monica 789797
Bob
Beverly
3 John 587123
is that possible? and if it's possible, how to achieve it using linq to sql?
Because there are limited number of addons on the passport, maximum is 5.
I've added 10 columns to the passport table like this:
addon_1
addon_1_birthday
addon_2
addon_2_birthday
addon_3
addon_3_birthday
addon_4
addon_4_birthday
addon_5
addon_5_birthday
May be it's not the best solution, but it has satisfied the requirement, by using only 1 table for the Crystal Report.
And I hope that could help other people having same issue.

OBIEE 11g Hierarchical columns. How to accomplish what we would normally do with a union report

So we have a hierarchy relationship for phases of a process:
Overall Phase
|----Phase 1
|----Intermediate Phase
| |----Phase 2
| |----Phase 3
|----Phase 4
Then we have many objects that go through these phases. These objects belong to one of several different types, let's call them A, B, and C.
So we can build a pivot report like this which tells us the total (or average) time spent in each phase for each different type:
Phase A B C
Overall Phase 11 11 12
|----Phase 1 3 2 4
|----Intermediate Phase 6 6 6
| |----Phase 2 2 1 1
| |----Phase 3 4 5 5
|----Phase 4 2 3 2
Now the thing is, each phase has a goal associated with it, which we want to be able to compare to the actuals easily. I think we could do it where there would be a goal column paired with each different type column, but what if we wanted instead to only display the goal at the end, like this:
Phase A B C Goal
Overall Phase 11 11 12 13
|----Phase 1 3 2 4 3
|----Intermediate Phase 6 6 6 6
| |----Phase 2 2 1 1 2
| |----Phase 3 4 5 5 4
|----Phase 4 2 3 2 4
Our first thought was to do a union report, but this is not supported with hierarchical columns. Having a seperate report won't work because expanding or collapsing the hierarchy will leave the two out of sync.
This is new ground for us, and we're drawing a conceptual blank about how to handle such a thing. Any ideas about what we need to do in order to accomplish this?
Current (simplified) table structure is something like this:
**Fact table**
OBJECT_FK
PHASE_FK
PHASE_START_DATE
PHASE_END_DATE
**Phase Dim**
PHASE_KEY
PHASE_NAME
PARENT_PHASE_KEY
GOAL
**Phase Hierarchy**
ID
PARENT_ID
LEVEL
IS_LEAF
**Object Dim**
OBJECT_KEY
TYPE
In OBIEE, you have to model a fact fragmentation.
Goal is a value that is dependent of a combination of dimension. You can have a goal by phase but you can also have a goal by phase and by department for instance.
Then create another fact table with two columns:
the phase id
your goal
And import it in your model.
You have an example here. They are talking about quota and the table is in an Excel file but the concept is the same.
http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/bi/biee/r1013/bi_admin/biadmin.html#t8
Cheers
Nico

Resources