2 Replies Latest reply on Nov 19, 2016 12:52 AM by Marc MOUSSA

# Calculating average monthly charges and compare before and after

The purpose of this calculated field is to determine the average monthly charge prior to a patient moving into an apartment, compared to the average monthly charge after they have moved in.

Some patients have several dozen months of hospital charges dating back to 2013.  Between 11-15 and 10-16 we placed them into housing.  So, without averaging their monthly costs, the charges before will be much more than after, since they may be only 2-12 months of charges.  So I need to calculate average monthly charges before the move-in date and compare that to the average monthly costs after the move-in date.

There are three fields:

Charge Service Date

Move-In Date

Charge

I have been able to calculate whether the Charge Service Date is before the Move-In date:

IF (ATTR([MOVE-IN DATE]) > ATTR([HEALTHQUEST].[CHARGE SERVICE DATE])) THEN 'BEFORE'

ELSEIF (ATTR([MOVE-IN DATE]) < ATTR([HEALTHQUEST].[CHARGE SERVICE DATE])) THEN 'AFTER'

END

Any suggestions?

• ###### 1. Re: Calculating average monthly charges and compare before and after

Hey Stephen,

This question would be easier to answer with a packaged workbook. If you have sensitive data, please check out Anonymize your Tableau Package Data for Sharing.

Thanks,

-Diego

• ###### 2. Re: Calculating average monthly charges and compare before and after

My first question is why are you using the ATTR function ?

You're doing a row level calculation you don't need the attr function.