Thursday, January 28, 2016

Trusted Authentication in Tableau with ASP.NET

When you use Tableau in an enterprise setup, you might want to bypass authentication for the users, especially if there is already some way you can identify your users, using an AD/portal login.

Technical details about Trusted authentication with Tableau can be found here .

My Tableau environment setup 

Tableau version 9.1
Windows Server 2012
IIS Server running on the same system (ideally it will be on a separate machine, but hey - this is just a demo)

Required access and tools

Tableau admin access to create generic user and modify view access
MS Visual Studio for creating a ASP.NET Application

Here are the steps taken for to enable Tableau Authentication (as outlined by Tableau docs here and here):

  1. Create a generic user account in Tableau server, lets call the user TabGenericUser.
  2. Assign TabGenericUser read-only access to a few views in our server.
  3. Find the IP address of the application server where the web server will reside (in our case it is localhost, as it's the same server where Tableau is hosted)
  4. Add Trusted IP Addresses or Host Names to Tableau Server. This step is outlined here
  5. Remember that in this flow, the client no longer logs on to the Tableau server directly, but through the web server. Although we wrote the portal in ASP.NET, it could just as easily be written in a language of your choice. The function of the portal/web server would be to :
    • Receive requests from client browser.
    • Connect to Tableau server as TabGenericUser for an authentication request. Tableau server identifies the request as originating from a trusted IP (as configured in step 4).
    • Receive an authentication ticket that can be used to access reports on the server. Note that only those views can be accessed to which TabGenericUser has access.
    • Construct a URL of the requested report. This URL includes the authentication ticket issued by the server. 
    • Web Server can now serve up the report in the browser directly (using script tag or an iframe).
    • Optionally, client IP matching can be done for additional security (as shown here)
The ASP.NET application code for getting the Tableau Authentication ticket : 

        private string GetTableauAuthenticationTicket()
        {
            var request = (HttpWebRequest)WebRequest.Create(hostName+"/trusted");
            var encoding = new UTF8Encoding();
            var postData = "username=" + userName;  //userName = "TabGenericUser"

            byte[] data = encoding.GetBytes(postData);

            request.Method = "POST";
            request.ContentType = "application/x-www-form-urlencoded";
            request.ContentLength = data.Length;
            
            using (var stream = request.GetRequestStream())
            {
                stream.Write(data, 0, data.Length);
            }
            var response = (HttpWebResponse)request.GetResponse();
            return new StreamReader(response.GetResponseStream()).ReadToEnd();

        }

Once the authentication ticket is returned by this method, you can use it to construct your view-URL like so:

http://TABLEAU_SERVER:PORT/trusted/<ticket>/views/<workbook>/<view> 
OR, if you have multiple sites in your Tableau server, specify the site explicitly :
http://TABLEAU_SERVER:PORT/trusted/<ticket>/t/Sales/views/<workbook>/<view> 

Feel free to comment if you have any follow-up questions, or if any specific step needs further explanation. You can also reach me on twitter @shafeeqrtk .

Thursday, September 3, 2015

From graphic impact to dashboarding glory

Many dashboard projects fail not due to the lack of quality of data, but due to the lack of effort in the visual presentation of the data. It's a pity to see how much effort is spent on a dashboard strategy, liaising with multiple teams and spending months to get the data right, only to find that eventually the usage reports tell you exactly what you've suspected:  the users are not engaging with your dashboards. 

With the same quality of data, a strong graphic impact can transform a good dashboard into a great dashboard. Don't hesitate to explore the graphic capabilities of the tool that you're using: change colors, import graphics, add shapes and borders.  If you use design components creatively, intelligently applying them to your dashboards, you'll be destined for dashboarding glory.

Your dashboard tool of choice will give you certain stock visual elements like charts, graphs, labels with default colors, fonts and themes. For simple scenarios and quick prototypes, this is definitely good enough. However, if you want your dashboard to command the attention of your end users, these stock visual elements are just the starting point. There are a number of tricks you can use to boost the visual impact of your dashboard. Consider hiring a professional graphic artist to take an out-of-the-box design to the next level.  Using a professional design, you can craft a clean, simple, elegant dashboard, that looks nothing like what could have been built out of the box. 

Let's consider an example with a simple dashboard. 


Plain vanilla dashboard with DecisionPoint


This is a dashboard, built by Analysis Factory using Antivia's DecisionPoint tool. As you can see, it has drill downs to the left that drive the scorecard to the right and the charts at the bottom. We have used everything out of the box and come up with a good dashboard that conveys the desired information. 


All good.  But it could be so much better!

This dashboard uses DecisionPoint's default fonts, tables, and colors. What is evident is that it lacks finishing or an identity. But, with a little work and craftsmanship, this dashboard can be catapulted into a completely different league. 

So, how do we prepare to makeover this dashboard?

  1. Decide what elements of the dashboard should be emphasized via graphic design.  If you have access to the services of a professional graphic designer, ask them to prepare a proposed rendering of the dashboard.
  2. Determine what components in your BI tool will allow you to create graphic interest:  background colors, lines, shapes, images.
  3. Determine what color palettes and themes are already built into the tool and how to apply them. 
  4. Can any other elements of the dashboard be adjusted visually?  For example, can borders be added to scorecard components?


For this dashboard, we are using a Analysis Factory blue-white-yellow logo prepared by our creative artist. 




We insert it into our DecisionPoint dashboard by using the Image component in the Interface menu.





Images and other graphic elements are added to the UI in layers.  Sometimes a component or graphic is hidden under the layer of another element:

Eg. A combo box half-hidden behind an image component


Right-clicking on any component in the canvas will allow you to adjust the layering.


Bring the graphic element to the front so that it displays properly:





Here is an overview of how we transformed this dashboard.

Step 1 - Introduce the dashboard logo and header 




Step 2 - Add the background image for the dashboard


Background added

This background incorporates visual tricks that add borders and enclosures for the scorecard and tab components, giving it a polished look.

Step 3 - Add the yellow card backgrounds for drop down labels 




Step 4 - Add Header line and scorecard legends


Addition of header line and scorecard legend
The header line is just a horizontal line component from the Components window.

Step 5 - Color palette and Fonts

Another thing that we try to do is to use an alternate color palette, that goes with the rest of the dashboard. We have some options to choose from under File > "Dashboard Properties"

Changing themes



With custom themes (supported only by DecisionPoint Enterprise edition), you can create a UI theme specific to your organization that can be used across different DecisionPoint dashboards. This is a really powerful developer feature, but you will need a CSS ninja to get this right. 

We at Analysis Factory have built custom themes in DecisionPoint that we were able to use for this dashboard. If it's too much, you can use any of the pre-built ones provided by Antivia. 

Custom theme built by Analysis Factory



Applying our custom theme, we finish off the dashboard:






You can see how we have used colors, backgrounds, and imported graphics to produce a distinct identity for this dashboard.  With a few changes, the dashboard now looks elegant AND powerful, with the relevant data analysis such as the scorecard alerts boldly popping out at the user. This is a design that will provide actionable information for your users at a quick glance.

You can explore this dashboard(and other dashboards) live at the Antivia gallery page: 


Do share your valuable feedback and ideas as a comment. And if you are looking for help with DecisionPoint, Tableau, SAP Dashboards, Roambi or even custom HTML5 dashboards, you can reach us at contact [at] analysisfactory.com. 




Friday, August 28, 2015

Add natural language to your dashboards for "spot answers to BI questions"


As dashboard designers, we want users to grasp at a glance the message the dashboard is conveying. Wouldn't it be great if a dashboard, upon launch, automatically communicated high-level information in plain, natural language? This can be done by incorporating natural language into the display of pertinent data. When information is displayed in the context of simple sentences, the target user can quickly grasp the gist of the message. Then the rest of the dashboard provides the detailed answers.
Users' immediate BI questions are answered on the spot, greatly reducing the need for “figuring it out themselves.”

To see how natural language text can be incorporated into a dashboard, let’s look at a demo, “London Bike Share,” that Analysis Factory built using Antivia's DecisionPoint™ tool.


Here's a look at the dashboard :

London Bike Share dashboard

You will see that we have a display card that says "Quick Info".
This has the natural language text that we were just discussing.

The first sentence shows the average ride duration across all years, followed by average ride duration for the selected period (in this case, 2013). We are also comparing this average ride duration with the average across all years, to get a sense of how active people were in 2013, as compared to all time.

The recipe for this solution is to use the concat or concatenate function in DecisionPoint.

You can use the concat function in a Label component to combine text, like so:

=concat("The overall average ride duration is ","[TIME]"," minutes.")

This gives us -



Not quite what we intended, we now need to figure out how to get the real [TIME] using our dataset.

Here's a look at the underlying dataset for this dashboard-

Dataset for London Bike Share Dashboard

"Subset1" is a subset of the main dataset, which has a measure called "AvgRideDuration". 

We are looking to display the average of "AvgTimeDuration" in our formula.
For this purpose, we use the select() function to first fetch the field.

=concat("The overall average ride duration is ",SELECT("Subset1","AvgRideDuration","1=1")," minutes.")


But this will give us back a list of all the rows, something like this:


This is a list of values, and we can easily find the average of this list by using the AVERAGE() function

The formula now becomes :

=CONCAT("The overall average ride duration is " ,AVERAGE(SELECT("Subset1","AvgRideDuration","1=1")) ," minutes.")

And the result is :


To polish this a little further, we add the ROUND() function.

=CONCAT("The overall average ride duration is " ,ROUND(AVERAGE(SELECT("Subset1","AvgRideDuration","1=1")),1) ," minutes.")

Resulting in:


And thats it! 

Thanks for reading. Do share your valuable feedback and ideas as a comment. In case you are looking for help with DecisionPoint, Tableau, SAP Dashboards, Roambi or even custom HTML5 dashboards, you can reach us at contact [at] analysisfactory.com.