By using javascripts, many requirements that seems to be impossible in analytics can be implemented easily. The following report is one such example.
This report has a column selector on Time dimension that has Quarter/Month/Week and a fact "# of Service Requests". The tricky part about this report is to show 2 quarters when Quarter is selected in Column Selector, 12 months when month is selected and 8 weeks when Week is selected in the column selector.
This report has a column selector on Time dimension that has Quarter/Month/Week and a fact "# of Service Requests". The tricky part about this report is to show 2 quarters when Quarter is selected in Column Selector, 12 months when month is selected and 8 weeks when Week is selected in the column selector.
1. Create a report with columns Quarter and # of Service Requests in criteria and sort Qaurter in descending order. Apply filter for 12 months as it is the largest span in all 3 required conditions.
2. Click on Column Properties of Open Qaurter and in Data Format select Override Default Data Format.
3. Select Custom Text Format from Drop down menu and paste the following code
@[html]"<""script"">""document.getElementById(""\"Test\""").innerHTML""=""\"3\""";"document.getElementById(""\"columnHeading\""").innerHTML""=""\"Quarter\""</"script">"@
4. Click on Results Tab.
5. Add a Column Selector View and add Month and Week columns to it.
6. Select Month from the column selector and click on Criteria.
7. Click on column properties and change the data format to custom text. Copy the following code in the Custom Text Format:
@[html]"<""script"">""document.getElementById(""\"Test\""").innerHTML""=""\"13\""";"document.getElementById(""\"columnHeading\""").innerHTML""=""\"Month\""</"script">"@
8. Repeat steps 5,6 & 7 for column Week and use the following code for Week column.
@[html]"<""script"">""document.getElementById(""\"Test\""").innerHTML""=""\"9\""";"document.getElementById(""\"columnHeading\""").innerHTML""=""\"Week\""</"script">"@
9. Go to results tab and create a narrative view. 10. In narrative view check the contains HTML Markup checkbox and add the following code Prefix:
<a Id="Test"></a><table Id= "myTable" class="ResultsTable" onmouseover="RTOver(event)" onmouseout="RTOut(event)" title="Results" border="1" cellpadding="2" cellspacing="0"><tr><th Id="columnHeading" scope="col" class="ColumnHdgD"></th><th scope="col" class="ColumnHdgD"># of Calls</td></tr>
Narrative:
<tr><td>@1</td><td>@2</td></tr>
Postfix:
</table><Script>var counter=document.getElementById("Test").innerHTML;var numberOfRows=document.getElementById("myTable").rows.length;for (i = 0 ; i <= (numberOfRows-counter); i++ ){document.getElementById("myTable").deleteRow(counter);} </Script>
11. In Compund View delete the table view and add Narrative view.
No comments:
Post a Comment