Git Product home page Git Product logo

sql-server-and-power-bi-project's Introduction

Pharmaceutical Product Performance and Trend Analysis

Project Overview

This project aims to analyze the performance and trends of pharmaceutical products using SQL Server for data management and Power BI for visualization. The analysis covers various aspects, including product popularity, pack performance, trend analysis, relationship mapping, and market status distribution.

Objectives

  1. Product Popularity: Which products are the most prescribed?
  2. Pack Performance: Which packs have the highest total links?
  3. Trend Analysis: How have product prescriptions changed over the last five years?
  4. Sequencial Analysis: How have the number of published title evolved over the years, and which authors and periods have had the most significant impact on the overall publication trend?
  5. Relationship Analysis: What are the common relationships between prescribable products?

Solution Approach

We solved these objectives by executing SQL queries on the DBATest database in SQL Server and visualizing the results in Power BI.

Queries

1. Product Popularity

Query:

SELECT 
    pp.sProductDisplayName,
    COUNT(lp.iPrescribableProductID) AS TotalPrescriptions
FROM 
    [DBATest].[dbo].[SX_PrescribableProduct] pp
JOIN 
    [DBATest].[dbo].[SX_linkPack] lp ON pp.iPrescribableProductID = lp.iPrescribableProductID
GROUP BY 
    pp.sProductDisplayName;

2. Pack Performance

Query:

SELECT 
    p.sPackDisplayName,
    COUNT(lp.iDispensiblePackID) AS TotalLinks
FROM 
    [DBATest].[dbo].[SX_Pack] p
JOIN 
    [DBATest].[dbo].[SX_linkPack] lp ON p.iDispensiblePackID = lp.iDispensiblePackID
WHERE 
    p.sPackDisplayName IS NOT NULL
GROUP BY 
    p.sPackDisplayName
ORDER BY 
    TotalLinks DESC;

3. Trend Analysis

Query:

SELECT 
    YEAR(lp.dDate) AS Year,
    COUNT(lp.iPrescribableProductID) AS TotalPrescriptions
FROM 
    [DBATest].[dbo].[SX_linkPack] lp
JOIN 
    [DBATest].[dbo].[SX_PrescribableProduct] pp ON lp.iPrescribableProductID = pp.iPrescribableProductID
WHERE 
    lp.dDate IS NOT NULL AND lp.dDate >= DATEADD(YEAR, -20, GETDATE())
GROUP BY 
    YEAR(lp.dDate)
ORDER BY 
    Year;

4. Sequencial Analysis

Query:

SELECT Author
,[Year]
,no_of_titles as [Number of Titles] 
FROM	(
		SELECT 
		CONCAT(a.au_fname, ' ', a.au_lname) AS Author
		,year(c.pubdate) as [Year]
		,count(b.title_id) as no_of_titles
		FROM		[DBATest].[dbo].[authors] a

		INNER JOIN	[DBATest].[dbo].[titleauthor] b
		ON			a.au_id = b.au_id

		INNER JOIN	[DBATest].[dbo].[titles] c
		ON			b.title_id = c.title_id

		Group by CONCAT(a.au_fname, ' ', a.au_lname)
		,year(c.pubdate)
)aa
Order by 1

5. Relationship Analysis

Query:

SELECT 
    pp1.sProductDisplayName AS ProductFrom,
    pp2.sProductDisplayName AS ProductTo,
    COUNT(r.iRelationshipTypeID) AS TotalRelationships
FROM 
    [DBATest].[dbo].[SX_PrescribableProduct] pp1
JOIN 
    [DBATest].[dbo].[SX_PrescribableProductRelationship] r ON pp1.iPrescribableProductID = r.iPrescribableProductFromID
JOIN 
    [DBATest].[dbo].[SX_PrescribableProduct] pp2 ON r.iPrescribableProductToID = pp2.iPrescribableProductID
GROUP BY 
    pp1.sProductDisplayName, pp2.sProductDisplayName
ORDER BY 
    TotalRelationships DESC;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.