Skip to main content
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

1 Solution

Accepted Solutions
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

View solution in original post

13 Replies
ecolomer
Master II
Master II

Is this?

P08.png

Not applicable
Author

Create a Straight Table and put [Drug Name] as Dimension and below as expressions:

Total Prescriptions (TRx) which is an aggregate count of all Original and Repeat records for all [Drug Name] field

=count([Repeat or Original])

New Prescriptions (NRX) which is an aggregate count of all Original only records for all [Drug Name] field

=count({<[Repeat or Original] = {"Original"}>}[Repeat or Original])

Total Drug Prescriptions (TDRx) which is an aggregate count of all Original and Repeat records for a particular [Drug Name]

This will be same as First expression, for each Drug Name, the count will be displayed.

OR

=count({<[Drug Name]= {"Frusemide"}>}[Repeat or Original])

New Drug Prescriptions (NDRx) which is an aggregate count of all Original only records for a particular [Drug Name]

Same as expression 2.

OR

=count({<[Repeat or Original] = {"Original"},[Drug Name]= {"Frusemide"}>}[Repeat or Original])



Hope this was helpful.


Thanks,

Singh

Anonymous
Not applicable
Author

Hi Enrique

Many thanks, that is correct.

Regards.

Anonymous
Not applicable
Author

Hi Enrique

Further to my last response confirming that this is what i am looking for, can you kindly explain how you arrived at the solutions posted.

Regards.

Chris

Anonymous
Not applicable
Author

Many thanks for your input.  However, i need to be able to use the output to do further calculations in more straight table charts using calendars to view year to date, current month, previous month etc point in time analysis charts.  Will this be possible if i use straight tables to calculate these fields.  I have already done so in my application.  Please see attached screenshotScreen Shot 2014-10-27 at 22.55.22.png

Not applicable
Author

Hello Christopher,

You can create Variables for generic expressions and then use them in other objects of your dashboard over different dimensions.

vTRx  =count([Repeat or Original])

vNRx  =count({<[Repeat or Original] = {"Original"}>}[Repeat or Original])


If you need to extend these expressions in other straight tables, then I guess you have to duplicate them there as well with other requirements embedded.

Hope this was helpful.

Thanks,

Singh

Anonymous
Not applicable
Author

Dear Singh

Further to my last questions.  I am trying to calculate the current month total prescriptions (TRx) with the following script:

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

This is not giving the right value.  Is anything wrong with the above?

regards.

Chris

Anonymous
Not applicable
Author

Hi Enrique

i am still waiting for your response.  How did you arrive at the results posted?

Regards

Chris

Not applicable
Author

Hello,

The the current month total prescriptions (TRx) can be calculated as :

count({<MonthSeq = {"=$(max(MonthSeq)"}>}[Repeat or Original])

where MonthSeq is the monthnumber the way u are calculating vSetPreviousNMonth

For:

Try selecting the current month from calendar and see whether he blow returns correct results or not.

Aggr(TextCount([Repeat or Original]), [Drug Code])