AWS Business Intelligence Blog
Streamline your reporting process with Amazon QuickSight automation
Amazon QuickSight stands at the forefront of AWS business intelligence (BI) and data visualization offerings, enabling organizations to create and share interactive dashboards, perform one-time analyses, and glean actionable insights from their data. In today’s data-centric business environment, the ability to efficiently generate and distribute insightful reports across different segments or regions remains a critical challenge for many business.
Addressing this challenge, we delve into the automation of report processing workflows. For our use case, a real estate customer wants to send state-specific weekly real estate reports for each state to their regional agents. In this post, we show you how to use QuickSight, combined with its Snapshot APIs and other AWS services, to automate this process.
Solution overview
Our solution uses the following key services:
- Amazon EventBridge
- AWS Step Functions
- Amazon QuickSight
- Amazon Simple Notification Service (Amazon SNS)
- Amazon Simple Storage Service (Amazon S3)
The following diagram illustrates the high-level architecture of our solution. We use Amazon QuickSight Pixel-perfect Reports to create reports containing business-critical information. We use a parameter filter for regional segmentation. To generate PDF reports for various states, we use the QuickSight Snapshot APIs. A Step Functions state machine orchestrates the report processing using AWS Lambda functions, employing Distributed Map for parallel processing of the reports. We use Amazon SNS to notify stakeholders when the reports are successfully generated. Finally, we use EventBridge Scheduler to automate the report processing on a weekly basis.
The following diagram illustrates the solution architecture.
The following diagram illustrates the Step Functions workflow.
Prerequisites
To run this solution, you must have the following:
- A QuickSight Enterprise account. If you don’t already have one, you can sign up for one.
- A QuickSight account with the Pixel-perfect Reports add-on enabled.
- The AWS Command Line Interface (AWS CLI).
Create a QuickSight dashboard
In this section, we walk through the steps to create a QuickSight dashboard with a pixel-perfect report, customize it, and publish it.
Create a pixel-perfect report
To create a pixel-perfect report, complete the following steps:
- Download the sample dataset.
- On the QuickSight console, choose Datasets in the navigation pane.
- Choose New dataset.
- Choose Upload a file and upload the CSV file of the sample dataset.
- Choose Next.
- Choose Visualize.
- Choose Pixel-perfect report from New sheet and choose Create.
Add a logo to your report header
To add a logo to your report header, complete the following steps:
- Choose the HEADER section in the report layout.
- Choose + ADD and then Custom visual content on the application bar.
- Open the Format visual pane for Customize visual.
- For URL under Custom Content, enter
https://ws-assets-prod-iad-r-iad-ed304a55c2ca1aee.s3.us-east-1.amazonaws.com/cd8ebba2-2ef8-431a-8f72-ca7f6761713d/images/ac_logo_orange.png.
- Choose Apply.
Add a title and date to the report
To add a title and date to the report, complete the following steps:
- Choose the HEADER section in the report layout.
- Choose Add text on the application bar.
- Enter
Weekly Sales Report
into the text box and press Enter to add a new line. - Choose the calendar icon in text box toolbar.
- Choose the date format (EEEE, MMMM d, yyyy) for the report.
Add a footer to the report
To add a footer to the report, complete the following steps:
- Choose the FOOTER section in the report layout.
- Choose Add text on the application bar.
- Click anywhere inside the text box to add a page number.
- Enter
Page
in the text box, choose the hash (#) icon in the text box toolbar, and choose Page number / Page count. - On the next line, enter Contact info:
support@anycompany.com
. - Select all the text in the text box, choose the align icon in the toolbar, and choose Align center.
- Resize the text box to fit the full width of the footer.
Create a visualization for the sum of total homes sold
To create a visualization of total homes sold, complete the following steps:
- Choose + ADD on the application bar and then Add Visual.
- Choose Vertical bar chart from Visual Types.
- From the Fields list, drag
period_begin
to the X axis, and change the aggregation to Week. - Drag
total_homes_sold
to Value and change the aggregation to Sum.
Create a visualization for sum of total active listings by city and state
To create a visualization for total active listings by city and state, complete the following steps:
- Choose + ADD on the application bar and then Add Visual.
- Choose Points on map from Visual Types.
- From the Fields list, drag
city
to the Geospatial field. - Drag
total_active_listings
to the Size field and change the aggregation to Sum. - Drag
state
to the Color field.
Create a visualization for sales price by city and state
To create a visualization for sales price by city and state, complete the following steps:
- Choose + ADD on the application bar and then Add Visual.
- Choose Table from the Visual Types.
- From the Fields list, drag
state
andcity
to the Group by field. - Drag
median_days_to_close
,median_sale_price
,active_listings
, andtotal_homes_sold
to the Value field. - Change the Aggregation option.
Add a parameter field to the report
To add a parameter field to the report, complete the following steps:
- Choose the Parameters section on the top and choose Create one.
- For Name, enter
pState
. - Choose Create.
- Choose Filter and choose ADD FILTER.
- Choose the field
state
. - Edit the
state
filter, and for Applied to, choose All applicable visuals. - Change FilterType to Custom filter.
- Select Use Parameter and select the parameter
pState
. - Choose Apply.
Publish the dashboard
To publish the dashboard, complete the following steps:
- Choose PUBLISH.
- Enter the name as
realestate-weekly-report
. - Choose Publish dashboard.
- Note down the dashboard ID from the browser URL.
- In the AWS CLI, enter the following command:
- Note down the
SheetId
from the response.
Set up the environment
To set up the environment using AWS CloudFormation, complete the following steps:
- Sign in to the AWS Management Console.
- Choose Launch Stack:
- Choose Next.
- For Stack name, enter a name.
- In the Parameters section, enter the required parameters.
- Choose Next.
- On the Configure stack options page, leave all values as default and choose Next.
- On the Review stack page, select the check boxes to acknowledge the creation of IAM resources.
- Choose Submit.
Wait for the stack creation to complete (approximately 2 minutes).
This template configures the following resources:
- S3 bucket
qs-reporting-<accountid>-<region>
- Step Functions state machine
QSReporting-StateMachine
- Lambda functions
FireJobFunction
andJobStatusFunction
- SNS topic
QSNotification
- EventBridge Scheduler
QSEventScheduler
You can subscribe to the topic from the email you received, if you wish to get notified when the reports are available.
Initiate report processing
Now you’re ready to test the solution.
- On the EventBridge console, choose Schedules in the navigation pane.
- Choose the schedule
QSEventScheduler
. - Choose Edit and enter today’s date and a few minutes from the current time.
- Choose Skip and Save, then choose Save.
The Step Functions state machine starts running at the time you scheduled. Monitor the progress of the state machine and wait until it’s complete.
You can navigate to the S3 bucket to view the reports, and note that the reports are created for each state in their respective folders.
Clean up
To avoid incurring future charges, delete the resources created for the solution:
- On the Amazon S3 console, select the S3 bucket created as part of the CloudFormation stack, then choose Empty.
- On the AWS CloudFormation console, select the stack that you created and choose Delete to delete all the resources created by the stack.
Conclusion
In this post, we showed you how to build enterprise reports using QuickSight Pixel-perfect Reports and automate your weekly or monthly reporting tasks using Quicksight APIs and AWS serverless services. You can further extend this solution to FTP the reports using Amazon Transfer Family services. To learn more about QuickSight Pixel-perfect Reports, refer to Amazon QuickSight Pixel-perfect Reports.
About the Authors
Sumitha AP is a Sr. Solutions Architect at AWS. She works with customers and help them attain their business objectives by designing secure, scalable, reliable, and cost-effective solutions in the AWS Cloud. She has a focus on data and analytics and provides guidance on building analytics solutions on AWS.
Ahsan Zulfiqar is a Sr. Solutions Architect at AWS supporting SMB customers. His area of specialty is in Data Analytics, helping customers build robust, efficient, and scalable data platforms on AWS.
Sharadha Ravindranath is a Solutions Architect at AWS, helping SMB customers solve complex challenges to drive business transformations and unlock potential of the cloud to deliver exceptional results through innovation.