Categories: DAX
Tags:

Introduction

In today’s data-driven world, the ability to transform raw medical data into meaningful insights is not just a technical skill—it’s a powerful tool that can impact lives. In this project, I focused on analyzing a Liver Function Test (LFT) dataset using Power BI to demonstrate how healthcare data can be visualized, interpreted, and used for decision-making. As someone deeply involved in data analytics and training, I believe that real-world datasets like LFT reports provide an excellent opportunity to bridge the gap between theoretical learning and practical implementation.

This project is designed to help learners and professionals understand how to work with medical datasets, build KPIs, and create interactive dashboards that highlight critical health indicators. By applying DAX calculations, data modeling, and visualization techniques, we can uncover patterns such as abnormal enzyme levels, protein deficiencies, and potential liver health risks. The goal is not only to build a dashboard but also to develop analytical thinking—understanding what the data is telling us and how it can be used effectively.

Whether you are a beginner in Power BI or someone looking to enhance your portfolio with a healthcare analytics project, this LFT dataset serves as a perfect case study to learn, apply, and showcase your skills in a meaningful way.


Dataset Explanation

The dataset used in this project is based on Liver Function Test (LFT) parameters, which are commonly used in the medical field to assess the health of a patient’s liver. Each row in the dataset represents an individual patient, and the columns capture various biochemical markers and demographic details that help in diagnosing liver conditions.

The dataset begins with a Gender column, which categorizes patients into male, female, or other. This allows us to perform demographic-based analysis and identify whether liver-related issues show any gender-specific patterns. While gender itself may not directly indicate liver disease, it can help in segmenting the data for deeper insights.

The next set of columns focuses on liver enzymes, including ALT (Alanine Aminotransferase), AST (Aspartate Aminotransferase), and ALP (Alkaline Phosphatase). These enzymes are crucial indicators of liver function. Elevated levels of ALT and AST often suggest liver cell damage, while high ALP levels may indicate bile duct obstruction or other liver-related complications. These parameters are extremely valuable when building KPIs or identifying high-risk patients.

Another important group of columns is related to bilirubin levels. The dataset includes Total Bilirubin, Direct Bilirubin, and Indirect Bilirubin. Bilirubin is a substance produced during the breakdown of red blood cells, and its levels help in diagnosing conditions such as jaundice or liver dysfunction. The relationship between direct and indirect bilirubin is particularly useful for identifying abnormalities, and it can also be used to create calculated columns for deeper analysis.

The dataset also includes protein-related measures such as Albumin and Total Protein. Albumin is a protein produced by the liver, and low levels often indicate poor liver function or chronic liver disease. Total Protein, which includes albumin and globulin, provides a broader view of the body’s protein status. These columns are highly useful for understanding long-term liver health and nutritional status.

Finally, the dataset includes a target column named Is_Healthy, which classifies patients as either healthy or unhealthy. This binary classification is extremely valuable for building predictive models, creating comparison visuals, and designing dashboards that clearly distinguish between normal and abnormal cases.

Overall, this dataset is well-structured and ideal for Power BI analysis. It combines clinical relevance with analytical flexibility, allowing users to create meaningful dashboards, perform segmentation, and derive actionable insights.

Get the dataset Click Here to Download

1. DAX-Based Questions (10 Questions)

These are practice + interview + dashboard-building questions

🔹 Basic Level

  1. Total number of patients in dataset
  2. Count of healthy vs unhealthy patients
  3. Average ALT level across all patients
  4. Average AST level for unhealthy patients only
  5. Gender-wise patient count

🔹 Intermediate Level

  1. Average Total Bilirubin for healthy vs unhealthy comparison
  2. Percentage of unhealthy patients
  3. Max ALT level recorded and which category it belongs to
  4. Difference between Direct and Indirect Bilirubin (calculated column)
  5. Average Albumin for each gender and health status

2. KPI Measures (5 Measures – Basic → Advanced)


🟢 KPI 1: Total Patients

Total Patients = COUNTROWS(LFT_Data)

✅ Explanation:

  • Counts total rows in dataset
  • Each row = one patient
  • Used as a top-level KPI card

🟢 KPI 2: Healthy Patients Count

Healthy Patients = 
CALCULATE(
COUNTROWS(LFT_Data),
LFT_Data[Is_Healthy] = 1
)

✅ Explanation:

  • Filters dataset where Is_Healthy = 1
  • Counts only healthy patients
  • Uses CALCULATE() for filtering logic

🟢 KPI 3: Unhealthy Percentage

Unhealthy % = 
DIVIDE(
CALCULATE(COUNTROWS(LFT_Data), LFT_Data[Is_Healthy] = 0),
COUNTROWS(LFT_Data)
)

✅ Explanation:

  • Numerator = unhealthy patients
  • Denominator = total patients
  • DIVIDE() avoids divide-by-zero errors
  • Shows % of risk population

🟢 KPI 4: Average Liver Risk Score (Custom Advanced)

Liver Risk Score = 
AVERAGEX(
LFT_Data,
(LFT_Data[ALT] + LFT_Data[AST] + LFT_Data[Total_Bilirubin]) / 3
)

✅ Explanation:

  • Creates a custom risk indicator
  • Combines:
    • ALT
    • AST
    • Bilirubin
  • Uses AVERAGEX() → row-wise calculation

👉 This is advanced analytical thinking KPI


🟢 KPI 5: Abnormal Protein Ratio

Low Albumin % = 
DIVIDE(
CALCULATE(COUNTROWS(LFT_Data), LFT_Data[Albumin] < 3.5),
COUNTROWS(LFT_Data)
)

✅ Explanation:

  • Albumin < 3.5 = poor liver function
  • Calculates % of such patients
  • Helps detect chronic liver issues

3. Measures & Columns for Visuals (6 Use Cases)


🔵 1. Calculated Column: Bilirubin Difference

Bilirubin Difference = 
LFT_Data[Total_Bilirubin] - LFT_Data[Direct_Bilirubin]

✅ Explanation:

  • Helps validate:
    • Indirect Bilirubin logic
  • Useful for anomaly detection

Visual:

👉 Table / Matrix

  • Columns: Patient, Bilirubin Difference

🔵 2. Measure: Avg ALT by Health Status

Avg ALT = AVERAGE(LFT_Data[ALT])

Visual:

👉 Clustered Column Chart

  • Axis → Is_Healthy
  • Values → Avg ALT

✅ Insight:

  • Compare enzyme levels between healthy vs unhealthy

🔵 3. Measure: Patient Count by Gender

Patient Count = COUNTROWS(LFT_Data)

📊 Visual:

👉 Pie Chart

  • Legend → Gender
  • Values → Patient Count

✅ Insight:

  • Gender distribution

🔵 4. Measure: Avg Albumin

Avg Albumin = AVERAGE(LFT_Data[Albumin])

📊 Visual:

👉 Card + Bar Chart

  • Axis → Gender
  • Values → Avg Albumin

✅ Insight:

  • Detect low protein trends

🔵 5. Measure: High Risk Patients Count

High Risk Patients = 
CALCULATE(
COUNTROWS(LFT_Data),
LFT_Data[ALT] > 40 && LFT_Data[AST] > 40
)

📊 Visual:

👉 KPI Card

✅ Explanation:

  • Identifies patients with high liver enzyme levels
  • Uses multiple conditions

🔵 6. Measure: Avg Total Protein by Health Status

Avg Total Protein = AVERAGE(LFT_Data[Total_Protein])

📊 Visual:

👉 Stacked Column Chart

  • Axis → Is_Healthy
  • Values → Avg Total Protein

✅ Insight:

  • Compare protein levels across groups.

Conclusion

This project highlights how a structured approach to data analysis can transform a simple dataset into a powerful decision-making tool. By working with the LFT dataset in Power BI, we move beyond just numbers and calculations—we begin to understand patterns, identify risks, and generate insights that can be practically applied in healthcare scenarios. The use of DAX measures, calculated columns, and interactive visuals enables us to explore the dataset from multiple perspectives, making the analysis both comprehensive and insightful.

One of the key takeaways from this project is the importance of choosing the right KPIs. Metrics such as total patients, unhealthy percentage, liver risk score, and low albumin ratio provide a quick overview of the dataset and help users immediately understand the overall health trends. These KPIs act as decision-making indicators and are essential in any professional dashboard.

Another important aspect is visualization. By using charts like clustered columns, pie charts, and tables, we can present complex medical data in a simple and intuitive way. For example, comparing ALT and AST levels across healthy and unhealthy patients can quickly reveal patterns that might otherwise go unnoticed. Similarly, gender-based analysis and protein-level comparisons add depth to the dashboard and make it more interactive.

This project also demonstrates the importance of domain understanding. Without knowing what ALT, AST, bilirubin, or albumin represent, it would be difficult to interpret the data correctly. This is why combining domain knowledge with technical skills is crucial for any data analyst. It ensures that the insights generated are not only accurate but also meaningful.

From a learning perspective, this project serves as an excellent portfolio addition. It covers essential Power BI concepts such as data modeling, DAX calculations, KPI creation, and dashboard design. It also introduces learners to healthcare analytics, which is a rapidly growing field with immense opportunities.

Looking ahead, this dataset can be extended further by integrating machine learning models to predict liver disease, or by connecting real-time data sources for live monitoring. It can also be used in training programs to help students understand how data analytics can be applied in real-world scenarios.

Ultimately, this project is not just about building a dashboard—it’s about developing a mindset. A mindset that focuses on asking the right questions, analyzing data critically, and presenting insights effectively. This is what truly defines a successful data analyst in today’s competitive landscape.