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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
fcecconi
Partner - Creator III
Partner - Creator III

Calculation in Load

I would like to create a field that is the subtraction of 2 items.  However 1 item I want to take the min value of.  I would like something like this.

(Min(%ProgramAdmitDate_Num,1) - %EncounterAdmitDate_Num) as Program_delay

I am getting an error with this statement.

Thanks in advance for your help!

Frank

1 Solution

Accepted Solutions
sunny_talwar

Try this:

Join (Fact)

Load [Patient ID#],

  (Min(%ProgramAdmitDate_Num,1) as Min

Resident Fact

Where not IsNull(%ProgramDischargeDate_Num) and EncounterStatus ='Discharged' and RecoveryType='InPatient'

Group By [Patient ID#];

NewFact:

LOAD *,

         Min - %EncounterAdmitDate_Num as Program_delay

Resident Fact;


DROP

Table Fact;

View solution in original post

3 Replies
sunny_talwar

Can you share the complete script for this table? and is the min overall min or min by some dimension in this table?

fcecconi
Partner - Creator III
Partner - Creator III
Author

Here is the full statement

I am joining this data to a Patient Summary table

Join

Load

  [Patient ID#],

  (Min(%ProgramAdmitDate_Num,1) - %EncounterAdmitDate_Num) as Program_delay

Resident Fact

Where not IsNull(%ProgramDischargeDate_Num) and  EncounterStatus ='Discharged' and RecoveryType='InPatient';

sunny_talwar

Try this:

Join (Fact)

Load [Patient ID#],

  (Min(%ProgramAdmitDate_Num,1) as Min

Resident Fact

Where not IsNull(%ProgramDischargeDate_Num) and EncounterStatus ='Discharged' and RecoveryType='InPatient'

Group By [Patient ID#];

NewFact:

LOAD *,

         Min - %EncounterAdmitDate_Num as Program_delay

Resident Fact;


DROP

Table Fact;