Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
zturaiki
Contributor III
Contributor III

expression in pivot table

I have this row data for a list of admission patient in a hospital

.... ( Patient File No.   - Bed No - Admission Date -- Discharge Date )

Patient
  No.
Bed_NoAdmission DateDischarge Date
K3576213451A6/23/2013-
K3024123544A5/1/2013-
K3498364406B6/15/2013-
K3597984407B6/25/2013-
K36000844226/25/2013-
K3496213445B6/15/2013-
K3326224405B5/29/2013-
K33936632106/4/20136/6/2013
K3370723204A6/6/20136/6/2013
K3509813204B6/20/20136/20/2013
K3501283212B6/23/20136/23/2013
K3577753217B6/24/20136/24/2013
K3606063211B6/27/20136/28/2013
K36025532186/26/20136/28/2013
K36298432196/29/20136/30/2013
K30896943035/7/20136/4/2013
K3459273336K6/11/20136/15/2013
K34890734026/15/20136/16/2013
K3533483507C6/24/20136/24/2013
K34352343146/9/20136/12/2013

The user ask these questions :

1- Total No. of New Admission in selected year

for example :: if the user select :

Month(AdmissionDate ) = 7

year(Admission Date ) = 2013

Total No. of Patiient admitted in this year/month is = 16 patients

2 - Total No. of Existing Patient in selected year who is still admit but not discharge

for example :: if the user select :

Month(AdmissionDate ) = 7

year(Admission Date ) = 2013

select All patient where

admission Month(AdmissionDate ) <= 7 and year(Admission Date ) <= 2013 and month(discharge date)>7 and year(discharge date) >=2013

i would like to represent the data in a pivot table like the attached picture --- as an example ,,, but i face problem in

cacluating the existing patient ,, it gave me zero

Admission
  Year
Admission MonthExisting PatientNo. Of New
  Admission
2012Jan01125
Feb01110
Mar01069
Apr01195
May01147
Jun01067
Jul01017
Aug0983
Sep01037
Oct01007
Nov01102
Dec01128
2013Jan01092
Feb01014
Mar01071
Apr01101
May01123
Jun01190
Jul01103
Aug0954

attached is a sample of data in excel

1 Solution

Accepted Solutions
Not applicable

Hi,

in this case usually  I create a fact table like this.

export1.png

For example the row

Patient No. Bed_No Admission Date Discharge Date
K32306346055/30/20137/7/2013

is linked to these facts:

YEAR_ MONTH_ countAdmission countExist countDischarge
2013May1
2013Jun1
2013Jul1

The expression in pivot table will be sum(countExist)

View attached file.

View solution in original post

2 Replies
Not applicable

Hi,

in this case usually  I create a fact table like this.

export1.png

For example the row

Patient No. Bed_No Admission Date Discharge Date
K32306346055/30/20137/7/2013

is linked to these facts:

YEAR_ MONTH_ countAdmission countExist countDischarge
2013May1
2013Jun1
2013Jul1

The expression in pivot table will be sum(countExist)

View attached file.

zturaiki
Contributor III
Contributor III
Author


Thanks for the solution ,,, it help me ...