COGNOS report poor performance when using repeater - repeater

I have a table with 3 columns: CLIENT_ID, STORE_ID and MADE_PURCHASE. Basically I'm trying to get a list of CLIENT_ID and an array of STORE_ID where a customer made a purchase. For the following data, here is the expected result:
DATA:
CLIENT_ID
STORE_ID
MADE_PURCHASE
1
a
YES
1
b
YES
1
c
YES
2
a
YES
2
b
NO
2
c
YES
3
a
NO
3
b
NO
3
c
NO
Expected result:
CLIENT_ID
STORE_ID
1
a,b,c
2
a,c
I was able to achieve the desired result by creating a query to filter out lines where MADE_PURCHASE = 'NO'. Then I created a list in the report. The first column is CLIENT_ID then I insert a repeater in the second column that contains STORE_ID.
The problem is that the repeater slows my report by a factor about equal to the number of CLIENT_ID retrieved. For example if I run the query without a repeater and it returns 10 unique CLIENT_ID in 10 seconds, then adding the repeater slows the report to 100 seconds. As soon as I enter more than a few hundred CLIENT_ID in the prompt the report takes multiple hours to run.
I tried editing the master-detail relatioship between the list and the repeater without much change. Anyone has any idea how I could make it run faster?
P.S. I know the desired output format is not ideal but the goal is to mimic a legacy report that was built on excel using concatenate on STORE_ID, as such, the client wants to keep the original format.

You can try to edit the FM - Governors with the parameter (DQM) Master-Detail Optimization with "Cache Relaional Detail Query".

Related

Use Measure as filter - If Order Contains X then add filter on full Order

I'm trying to create a filter with a Measure that works as a Yes/No connected to a another Column
The problem is that I'm working in a Dataset/Cube, so I can not make it as a Calculated Column, but have to use a Measure.
If "Order Number" contains "Product123", then the whole Order Number is "Yes".
So when I filter on "Yes" then it include all Order Numbers that include Product123 and also maintain all other information on other products.
My goal of the report is something like:
If Order contain Product123, was is the Delivery Time compared to if Order does not contain Product123
So Result should look something like this
Order NO
Product Number
Include Product 123?
Order 1
Product 123
YES
Order 1
Product 700
YES
Order 1
Product 800
YES
Order 2
Product 900
NO
Order 2
Product 300
NO
Or without Product Number in
Order NO
Include Product 123?
Order 1
YES
Order 1
NO
Hope my question makes sense.

IBM Cognos Analytics - Multiple rows into single row

I am using Cognos Analytics 11.0.4 and I am trying to concatenate multiple rows into a single row.
ID Department
123456 Front Office
123456 Reception
123456 IT
What I would like to do:
ID Department
123456 Front Office|Reception|IT
I tried creating a repeater with a new query, adding ID, Department to it, then setting up a master detail relationship between query1 ID and query2 ID, finally adding a text item with the | character.
When running the report I only get the below.
ID
123456
Anyone know what might be going wrong? It is like the repeater and | in query2 are ignored for the final output.
I figured it out, as simple as it was, it took me a while to realise.
Exporting my report with the 'Run Excel Data' option couldn't handle the row operations required by the Repeater object.
Switching to 'Run Excel' resolved the issue.

Power BI Dashboard where the core filter condition is a disjunction on numeric fields

We are trying to implement a dashboard that displays various tables, metrics and a map where the dataset is a list of customers. The primary filter condition is the disjunction of two numeric fields. We want to the user to be able to select a threshold for [field 1] and a separate threshold for [field 2] and then impose the condition [field 1] >= <threshold> OR [field 2] >= <threshold>.
After that, we want to also allow various other interactive slicers so the user can restrict the data further, e.g. by country or account manager.
Power BI naturally imposes AND between all filters and doesn't have a neat way to specify OR. Can you suggest a way to define a calculation using the two numeric fields that is then applied as a filter within the same interactive dashboard screen? Alternatively, is there a way to first prompt the user for the two threshold values before the dashboard is displayed -- so when they click Submit on that parameter-setting screen they are then taken to the main dashboard screen with the disjunction already applied?
Added in response to a comment:
The data can be quite simple: no complexity there. The complexity is in getting the user interface to enable a disjunction.
Suppose the data was a list of customers with customer id, country, gender, total value of transactions in the last 12 months, and number of purchases in last 12 months. I want the end-user (with no technical skills) to specify a minimum threshold for total value (e.g. $1,000) and number of purchases (e.g. 10) and then restrict the data set to those where total value of transactions in the last 12 months > $1,000 OR number of purchases in last 12 months > 10.
After doing that, I want to allow the user to see the data set on a dashboard (e.g. with a table and a graph) and from there select other filters (e.g. gender=male, country=Australia).
The key here is to create separate parameter tables and combine conditions using a measure.
Suppose we have the following Sales table:
Customer Value Number
-----------------------
A 568 2
B 2451 12
C 1352 9
D 876 6
E 993 11
F 2208 20
G 1612 4
Then we'll create two new tables to use as parameters. You could do a calculated table like
Number = VALUES(Sales[Number])
Or something more complex like
Value = GENERATESERIES(0, ROUNDUP(MAX(Sales[Value]),-2), ROUNDUP(MAX(Sales[Value]),-2)/10)
Or define the table manually using Enter Data or some other way.
In any case, once you have these tables, name their columns what you want (I used MinNumber and MinValue) and write your filtering measure
Filter = IF(MAX(Sales[Number]) > MIN(Number[MinCount]) ||
MAX(Sales[Value]) > MIN('Value'[MinValue]),
1, 0)
Then put your Filter measure as a visual level filter where Filter is not 0 and use MinCount and MinValues column as slicers.
If you select 10 for MinCount and 1000 for MinValue then your table should look like this:
Notice that E and G only exceed one of the thresholds and tha A and D are excluded.
To my knowledge, there is no such built-in slicer feature in Power BI at the time being. There is however a suggestion in the Power BI forum that requests a functionality like this. If you'd be willing to use the Power Query Editor, it's easy to obtain the values you're looking for, but only for hard-coded values for your limits or thresh-holds.
Let me show you how for a synthetic dataset that should fit the structure of your description:
Dataset:
CustomerID,Country,Gender,TransactionValue12,NPurchases12
51,USA,M,3516,1
58,USA,M,3308,12
57,USA,M,7360,19
54,USA,M,2052,6
51,USA,M,4889,5
57,USA,M,4746,6
50,USA,M,3803,3
58,USA,M,4113,24
57,USA,M,7421,17
58,USA,M,1774,24
50,USA,F,8984,5
52,USA,F,1436,22
52,USA,F,2137,9
58,USA,F,9933,25
50,Canada,F,7050,16
56,Canada,F,7202,5
54,Canada,F,2096,19
59,Canada,F,4639,9
58,Canada,F,5724,25
56,Canada,F,4885,5
57,Canada,F,6212,4
54,Canada,F,5016,16
55,Canada,F,7340,21
60,Canada,F,7883,6
55,Canada,M,5884,12
60,UK,M,2328,12
52,UK,M,7826,1
58,UK,M,2542,11
56,UK,M,9304,3
54,UK,M,3685,16
58,UK,M,6440,16
50,UK,M,2469,13
57,UK,M,7827,6
Desktop table:
Here you see an Input table and a subset table using two Slicers. If the forum suggestion gets implemented, it should hopefully be easy to change a subset like below to an "OR" scenario:
Transaction Value > 1000 OR Number or purchases > 10 using Power Query:
If you use Edit Queries > Advanced filter you can set it up like this:
The last step under Applied Steps will then contain this formula:
= Table.SelectRows(#"Changed Type2", each [NPurchases12] > 10 or [TransactionValue12] > 1000
Now your original Input table will look like this:
Now, if only we were able to replace the hardcoded 10 and 1000 with a dynamic value, for example from a slicer, we would be fine! But no...
I know this is not what you were looking for, but it was the best 'negative answer' I could find. I guess I'm hoping for a better solution just as much as you are!

How to parse through a column in Pig to create additional columns

New Apache Pig user here. I basically have data in a format and need to split this into 6 columns to create my desired schema and then load into Pig for my existing script to run.
Sorry if the format below is untidy, i cant upload a picture due to reputation score.
Existing format has 3 columns
User-Equipment values::key:bytearray values:value:bytearray
user1-mobile 20130306-AC 9
user1-mobile 20130306-AT 21
user2-laptop 20130306-BC 0
Required format:
User Equipment Date Type "Count or Time" Value
user1 mobile 20130306 A C 9
user1 mobile 20130306 A T 21
Any suggestions on how to ge this done? IS there a regex I need to write?
The tricky thing here is all the columns have a delimiter (-) between them except "Type" and column "C or T"
If you don't have a common delimiter I can think of two possibilities:
You could implement your own LoadFunc as explained here: http://ofps.oreilly.com/titles/9781449302641/load_and_store_funcs.html
You could use REGEX_EXTRACT_ALL as explained here: Apache Pig: Extra query parameters from web log
Here you go for 2.:
A = LOAD 'abc.txt' AS (line:CHARARRAY);
B = FOREACH A GENERATE FLATTEN(REGEX_EXTRACT_ALL(line, '^(.+?)\\-(.+?)\\s(.+?)\\-(.)(.)\\s(.+)$')) AS (User:CHARARRAY,Equipment:CHARARRAY,Date:CHARARRAY,Type:CHARARRAY,CountorTime:CHARARRAY,Value:CHARARRAY);

I need serious help in changing the vaue of a column within the same column by going 2 rows up and changing the value

I am a DBA of 7 months so please bear with me. I am needing to write a code that will find a particular ProductIdentifier. When this particular ProductIdentifier is found, 1. I need to grab this ProductIdentifier. 2. I need to go 2 rows up and place that ProductIdentifier in the field that is 2 rows above it.
Here is my code(everything is sorted properly already in this table)
SELECT
SipID,
SaleInvoiceID,
AssociationNumber,
Priority,
TotalPrice,
TotalCost,
SerialNumber,
ContractNumber,
ActivatedThroughPAW,
DateCreatedatMidnight,
ReceivedDate,
InvoiceIDByStore,
Location,
ProductIdentifier,
Description,
ShortDescription,
CategoryName,
RevenueStreamID,
RevenueType
FROM REVISEDTABLE.
I will better show you what needs to be done ![enter image description here][1]
ProductIdentifier
AWUPG2001RGP -- replace this product identifier with the 'AWRPNS000%'
POSC0021PRW
AWRPNS000343 --take this product identifier
What I need for this code to do is this: whenever I find any ProductIdentifier like 'AWRPNS000%', I need for the query to take this and go 2 rows up and replace whatever ProductIdentifier is in this with 'AWRPNS000%'. I then need to insert the results into a table. I believe the best thing to do is to select the ProductIdentifier row again and give it an alias. This will be the row that I need to transform. I can then do a comparison to see if things worked out. I do not know how to write the code to do the actual grabbing of the ProductIdentifier and going up 2 rows and replacing it, so any help or input would be greatly appreciated.
So what does two rows up mean. Why is it two rows up.
e.g.
ID Class Type Date
1 1 2 20/12/2012
2 1 2 21/12/2012
3 1 2 22/12/2012 *
ie yes ID is two rows up but that's because The records are in ID and date order and there are at least three of them.
If you can come up with that rule e.g.
Select * From SomeTable Where Class = 1 and Type = 2 And Date = 20/12/2012
Then all your problems go away...