How to replicate attribute data for all lines in GoodData table report? - attributes

I'm working on a table report where the client needs all lines fulfilled with data, with no blank spaces.
We need the Date information, for example, to be repeated for each metric line. And so the Number, Week Day, and Store.
This can be made?

The grouping of attribute values happens automatically and it is there to make reports easy to read. There is not a functionality to repeat attributes values in reports. So, it cannot be made in the report.
Attribute values are repeated, if report is exported to CSV file.
You can try to redesign the report to avoid the grouping.

Related

Excel: Order by date within multiple IDs

I have a huge epidemiological dataset containing registry data with pathology reports and clinical information. I have merged several files into one masterfile in order to get all information from one file. Every patient is assigned an unique ID-number. Each patient can have several reports and hence the same ID number can be repeated several times in the ID column. For each ID entry = new row (= pathology or clinical report) there is a date of that sample/information reported.
My goal is to be able to read all pathology/clinical info for a particular ID within one row.
By sorting the IDs, I get a clear picture of the number of each ID that has been entered. The problem arises when there are several reports = multiple rows with identical ID because the dates within this one patients with several IDs = rows do not match. The dates come from pathology (sample date, answer date, clinical info date etc). The dates from pathology and clinical within one patient does not have to match exactly on the day but still within a reasonable timeframe e.g. within 1-2 months. This is best illustrated with an example.
I want to sort the columns so that dates from a particular row match together. I am sure there is a way to do that but I cannot figure it out.
Thanks in advance
The issue of mismatching records seems to arise once the two separate tables are merged into one. In order to fix this, there are several options you can take:
Re-do the merge but strengthen the way in which the tables are joined on.
Instead of only merging based on ID, see if there is another field that could easily connect the records, perhaps a medical record #, case #, or event #, and merge the tables based on this new field AND ID. This would be the strongest solution, however it will only work if you can find said field to strengthen the link.
A separate solution would be to first sort the original tables based on the dates so that they match up and then re-merging them together.
In theory this should solve your problem as I assume currently when matching up the two separate tables it is grabbing the first instance of patient X01 from both tables and matching them together. This can be confirmed by checking the merged query and looking to see if the mismatched records are in the same order as presented in the original tables. This is not perfect, as it relies on no clinical dates occurring between pathology dates for the record, so I would proceed with caution.
And to address your concern about losing track of ID's with multiple rows, this should not matter as in the end result after merged you can then sort by ID, however you can add multiple levels of sort by selecting the data and going to Data -> Sort -> Add Level. You can change the order in which the data is sorted (First by ID and then by Date).

Default date aggregation for Excel

What is the default behavior of adding a date, time, or datetime into an Excel pivot row/column? I have seen it sometimes add it as the "raw value", sometimes it will add it as a Year > Query > Value, and other times (?) perhaps in between. For example:
When does Excel add it without aggregating it, and when does Excel aggregate it? Does it have to do with value cardinality, date range, or something else?
First, every entry in the column has to be a date/time or you won't be able to group them. In that case, obviously, the default would be not grouped.
Assuming everything is groupable, the default is no grouping. Each date will show individually.
The exception is if a pivot cache already exists. In that case it will group based on what the pivot cache says - the last way that field was grouped. This happens when you have more than one pivot table on the same data. The first pivot table creates the cache and all subsequent pivot tables use that existing cache.
In a new workbook (2010), I add a date field to the Row Labels and they are initially ungrouped by default.
I group them by month
Now I go back to the original data and make a new pivot table. I add the date field to the Column Labels.
Because it uses the same cache, it automatically has them grouped the same way. Finally, I go back to the source data and replace one of the dates with a string. If I create another pivot table, it will look like the others. But when I refresh it ungroups them because I have a non-date in there.
And if I try to Group now, it says "Cannot group that selection"
That's why it works the way it does - shared pivot cache. There are ways you can give each pivot table it's own cache but that uses more memory. However, if you want to group the same data differently, that's what you have to do.

Difference between rows in the same coulm for values which met specific conditions

here's my input and my desidered output. Problem Is: I have a columns for product, price, and date and I want to build a cross table where I can see the price of the day before for every product.
How can I calculate column d-1 (day - 1) in my data table? Should I use Intersect/Over functions? What If I want to calculate my d-1 column on-the-fly in a cross table?
You have some options here, depending on how you want to display everything.
If all you want is an overall snapshot of how it changed between Today and Yesterday, probably the simplest thing to do is the following:
Avg(If([DATE]=Date(DateTimeNow()),[Price],NULL)) as [Today's Price],
Avg(If([DATE]=Date(DateAdd("day",-1,DateTimeNow())),[Price],NULL)) as [Yesterday's Price],
Avg(If([DATE]=Date(DateTimeNow()),[Price],NULL)) - Avg(If([DATE]=Date(DateAdd("day",-1,DateTimeNow())),[Price],NULL)) as [d-1]
This can be very useful for a dashboard or summary, and if you replace the "DateTimeNow" component with a Document Property controlled by an Input field, this can quickly show your user the change on a specific day.
The Over functions could still be quite useful, especially if you're using a date hierarchy of some form.
It will update on the fly to accommodate the columns grouped across the top, so if you're displaying by date, you can see how it's been changing each day, and if you're displaying by month, you can see it that way instead.
Avg([Price]) as [Avg Price],
Avg([Price]) - Avg([Price]) OVER (PreviousPeriod([Axis.Columns])) as [Avg Price Change]

Cognos drill-through

How to strip off the first word from a measure being selected in a chart in a source report and pass it to a target report so that it is consumed by a crosstab in that 2nd (target) report?
So, for example, my Source report has a measure called [High Risk %]. I want to pass the first word 'High' to a target report so that it filters the Risk Level dimension to only show [High] risk level data. The Risk Level dimension only has 3 values (High, Medium and Low).
This seems like it shouldn't be that big of a deal but I can't figure it out. How to do this in a prompt macro?
Create a calculated data item in the parent query which does this. Include it in the chart query, and pass that instead.

How do I create report-like data tables in Excel?

In the past I have created websites that extract data from a database and format it using tables.
Now, I am trying to do the same thing but with Excel, and I'm lost. I am used to using SQL commands to extract data from given fields and then sort/manipulate it.
Currently, I am able to print a report that provides me with an Excel spreadsheet full of raw data, but I would like to make my life easier and organize it into a report.
The column that I would like to reference contains duplicates, but the data in the adjacent columns is different.
To give an example, assume I had a spreadsheet of sales transactions. One column would be the Customer ID, and the adjacent columns would contain the quantity, the cost per unit, total cost, order ID, etc.
What I would want to do in this case would be to select all the transactions with the same Customer ID and add them together based on their Order ID. Then, I would want to print the result to a second sheet.
I realize that I can use built-in functions to accomplish this, but I would also like to format this report evenually using VBA. Also, since I will have a variable number of rows that differ from one report to the next, I haven't encountered a fucnction that will allow you to add rows.
I'm assuming this must be done with VBA.
Well you can do it manually, but it would take ages. So VBA would be good, particularly as you would be able to generate future reports quickly.
My interpretation of what your saying is that each row in your report will be the total for one customer ID. If it's something else, I imagine the below will still be mostly relevant.
I think it would be a bit much to give you the full answer, particularly as you haven't provided full detail but to take a stab at what you'd do:
Create your empty report page, whether it be a new worksheet or a new workbook
Loop through the table (probably using While next is not empty)
a. Identifying if a row is for a customer ID you haven't covered yet
i. If so then add a new entry in your report
ii. Else add it to the existing customer ID record (loop through until you find it)
Format your report so it looks pretty, e.g:
a. Fill the background in white
b. Throw in some filled bars
c. Put in good titles and totals etc.
For part 1, it might be better building an array first and then dumping the contents into the report. It depends how process intensive it will be - if very intense, an array should shave off time.

Resources