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: 
Anonymous
Not applicable

Loading Calculated Facts

Is it possible to load calculated 'Facts' when you are loading a table.  I have a table with the following fields and records:

[Drug Name] and [Repeat or Original]

Frusemide               Original

Frusemide               Repeat

Frusemide               Original

Frusemide               Original

Frusemide               Original

Frusemide               Repeat

Amlodipine              Original

Amlodipine              Original

Amlodipine              Original

Amlodipine              Repeat

Amlodipine              Repeat

Amlodipine              Original

i want to be able to load calculated fields based on the above records as follows:

  1. Total Prescriptions (TRx) which is an aggregate count of all Original and Repeat records for all [Drug Name] field
  2. New Prescriptions (NRX) which is an aggregate count of all Original only records for all [Drug Name] field
  3. Total Drug Prescriptions (TDRx) which is an aggregate count of all Original and Repeat records for a particular [Drug Name]
  4. New Drug Prescriptions (NDRx) which is an aggregate count of all Original only records for a particular [Drug Name]

if this is not possible, what is the alternative approach?

I hope my question is clear.  Thanking you in advance.

Regards

Chris

13 Replies
Anonymous
Not applicable
Author

Hello

Many thanks, if i select current month in the calendar it is returning the correct TRx count but this value is the same as the year to date value calculated as follows:

Sum({$<$(vSetYTD)>} Aggr(TextCount([Repeat or Original]), [Drug Code]))

I do not know what is going on.

regards.

Chris

Not applicable
Author

It will be great if you could post a sample file with expected numbers. That will help me and other members to give you prompt responses.

--Singh

Anonymous
Not applicable
Author

Hello Singh

I managed to figure it out.  I changed it to the following and it is now working:

Sum(Aggr(Count({$<$(vSetYTD)>} [Repeat or Original]), [Drug Code]))

Regards

Chris

Not applicable
Author

Great! Feel free to mark any answer as helpful or correct to close the thread.

Thanks,

Singh