Tableau conditional formatting is a feature that allows users to apply specific formatting rules based on data values. This means you can dynamically change the appearance of data points as they move through a chart or visualize numeric values depending on other variable criteria.
The ability to quickly identify which data points meet specific criteria using colors and symbols is invaluable when developing dashboards, reports, or business intelligence applications within the Tableau platform.
Tableau conditional formatting process
A conditional formatting process is used to create rules or formulas based on data values. The rules look for certain criteria and then format cells based on those conditions.
Most often, when Tableau users perform visual analysis on data, they use conditional formatting to highlight changes in trends or patterns.
By default, Tableau only allows rows or columns to be sorted. However, with custom sorting functions, you can sort on multiple fields simultaneously.
You can implement conditional formatting in Tableau using distribution volume data, size, and color measures based on parameters, as will be discussed further in this post.
We are creating a table with patients and their vital details, it has two key calculated fields ‘trigger hour’ and ‘transition hour’ .
'Trigger Hour' indicates the hour at which two or more vitals of a patient reached an abnormal range. 'Transition Hour' is the hour before the 'Trigger Hour'. When the patient reaches two or more abnormal conditions the 'Trigger Hour' will be activated and an email alert will be sent to the doctor with that patient's conditions. The different colors in the table show the abnormal ranges of vitals. By clicking the email alert an email will go to the doctor with that patient's records. Follow the steps below to accomplish this in Tableau Conditional Formatting.
Step 1: Patient ID, patient vital information, and hour are included in the data for this example. The data has been loaded into Tableau. When we switch to the sheet tab, we can see the measurements and dimensions included in each part.
Step2: To start, drag dimension Patient ID, Hour, HourType, EmailAlert into the Tableau conditional formatting Rows section as shown below.
Step 3: Next, create calculated fields in Tableau.
Step 4: Create a calculated field designated “0” and enter “0” in the code section. This field appears in the Measures section when created.
Step 5: Drag the calculated field twice in Tableau 0 values individually into the Columns area. It’ll create multiple marks in your view. First mark is for displaying measure values and the second mark will create a header title for your measure. Type 0 should be changed to AVG (Average). Choose Average in Measure from the field’s dropdown menu to do so.
Step 6: Select “Dual Axis” from the dropdown menu of the second 0 measure. This is shown in the screenshot below.
Step 7: Now we need to do some formatting in our view to get the desired output. Edit the Top and bottom axis by right-clicking on the top and selecting “Edit Axis” A dialogue window will pop up and update the Title from the General tab. Then go to Tick Marks and select major and minor tick marks as none
· Step 8: Changes to the bottom axis’ General and Tick Marks sections are similar to those made to the top axis, with the exception that the General section’s title is left blank, as shown below.
Step 9: Now select the first mark and Change the mark type from automatic to Square. You’ll get the below view
Step 10: From the image above, you can see that the colors have not filled the cell. If you want the colors to fill the entire cell, choose the largest size by moving the size slider to the rightmost position.
Below is an illustration of that.
Step11: Now you can drag your measure ‘Temp_C’ on the Color.
Step12: Now select the second mark and drag your measure on the label. Change the mark type from automatic to Text. You’ll get the below view
Step13: If the brightness of the background colors is intense, you can lessen it by adjusting the opacity through the Opacity slider in the Color section. In this instance, the opacity was maintained at 90%.
Similarly, modifying the parameters in the second 0 measure may change the opacity for text values.
Ensure that text values stand out over the backdrop colors; the opacity for text values should be kept at 100%.
Step 14: The steps mentioned above were taken for the Temp measure. HR, PaCo2, Resp, WBC are another significant metrics in the dataset. To analyze measuring SIRS Criteria. Repeat the steps mentioned earlier.
Switch the colors for WBC to Green, HR to Red, PaCo2 to Purple, and Resp to Orange as seen below, or choose another appropriate color.
Step 15: Now that the conditional formatting Tableau measure values analysis conducted appears as shown in the image below. You can see the Tableau conditional formatting text colors assigned on the right side according to the range of Temp,HR,PaCo2, Resp and WBC.
Step 16: The below image shows a more in-depth perspective of the analysis completed using conditional formatting.
Following the above steps you have completed the conditional formatting. Now you can refer below steps to trigger an email alert when the criteria are met(Criteria: when the patient reaches two or more vitals abnormal conditions)
Setting Up Email Alerts in Tableau, follow these steps:
Define the Data Condition: Start by identifying the data condition you want to monitor. This could be a threshold value, a percentage change, or any other relevant metric that signifies a significant event or trend.
Step 1: Create a calculated field to trigger an Email alert:
Tableau provides a user-friendly interface to specify when the alert should be triggered based on the calculated condition. Create a calculated field Email_Allert as shown in the below screenshot.
·
Step 2: Email Body: Create a calculated field for email body, include the text message or data fields that you want to display in the email. Refer to the below screenshot.
Step 3 : Once the Email body is created drag that field into the detail section under the Marks. Refer to the below screenshot.
In this data case, a trigger is required when two or more abnormal values are identified. As per the visualization, Tableau has identified the trigger instructions, and we see the ‘Send Email’ has been automatically generated in the Email_Alert column where two or more abnormal values are detected.
Define Recipients: Specify the email addresses of the recipients who should receive the alerts. You can choose to send alerts to individuals, groups, or distribution lists based on your organizational requirements.
Configure Email Settings: Before sending email alerts, configure the email settings in Tableau. Enter the SMTP server details, sender email address, and other relevant information to enable Tableau to send emails on your behalf.
Step 4 : To configure the email setting in Tableau, go to the Worksheet menu and click on Actions.
Step 5: The Actions let you create interactive relationships between data, dashboard objects, other worksheets, and the web. When the Action box pops up, click Add Action. Choose the action from the options as required by the task. Here, in our case we need to send an email alert, therefore we choose the Go to URL option.
Step 6: Fill out the URL Action form, insert the Name using the dropdown menu, and select the appropriate fields. For our data, from the calculated fields created let’s insert Notify Doctor, Email Alert, and Email Body.
· Choose the Source sheets where the action needs to be considered.
· Choose when the action needs to be run — Hover, Select, or Menu. For easy understanding, let’s choose ‘Select’ (the action will run only when you click the action in the visualization).
· We need the action to go to a New Brower Tab.
· Under URL, post the email address of the receiver of the trigger action. Here, we need to send the email to the doctor. Here’s how you insert the URL:
· mailto:doctor.its@gmail.com?subject= SIRS_Trigger_Alert SIRS_Trigger_Alert body=<Email Body>
Step 7 : Test the Alert: After configuring the email settings and defining recipients, test the alert to ensure that it triggers correctly based on the specified conditions. This step helps verify the accuracy and reliability of the alert mechanism.
In the above screenshot, you can observe the highlighted data such as Patient ID: 119977, the patient’s vitals have three abnormal measures,
Hour_Type value is ‘trigger’, which means there is an emergency, and the doctor needs to be notified immediately. On the right side of the screenshot, you can see the email has been successfully sent to the concerned doctor with the information. Hence the next appropriate action is immediately executed by the medical team of that patient.
Conclusion:
Conditional formatting in Tableau is a powerful feature that enhances the interpretability and visual appeal of your data visualizations. By applying conditional formatting, you can highlight important data points, and emphasize trends. By using color scales, icons, or calculated fields, conditional formatting allows you to tailor your visualizations to better meet the needs of your users.
Email alerts in Tableau offer a powerful mechanism for staying informed and proactive in today’s dynamic business environment. By setting up email alerts, users can monitor critical data conditions, receive timely notifications, and take actionable steps to drive success. Tableau email alerts enable users to fully utilize their data to take informed actions.
Comments