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

Calculating product portfolio age

I want to calculate the age of a product portfolio in years, months and days based on a field 'stat_date' and today's date and i am trying the following:

[MCAZAprroved]:
LOAD APPLICANT as MCAZApplicant,
If(Match(Trim(CATEFORY), 'HRA', 'HR', 'PID', 'PIM', 'P', 'PR', 'VMGD'), 'OTC',If(Match(Trim(CATEFORY), 'PP', 'PP10', 'N'), 'PRESCRIPTION', CATEFORY)) AS MCAZCategory,
   FORM as [MCAZ Dosage Form & Route of Admin],
"GENERIC NAME" as [MCAZ Active Ingredient] ,
MANUFACTURER as Manufacturer,
"REGISTRATION NUMBER" as [RegistrationNumber],
Date("stat_date") as MCAZActionDate,
STRENGTH as [MCAZ Strength],
"TRADE NAME" as MCAZTradeName,
"Manufacturer Status";
SQL SELECT APPLICANT,
CATEFORY,
FORM,
"GENERIC NAME",
MANUFACTURER,
"REGISTRATION NUMBER",
"stat_date",
STRENGTH,
"TRADE NAME",
"Manufacturer Status"
FROM PharmaMarketAudit.dbo.tblMCAZRegister;


PortfolioAge:
load

// Original Code by Haider Al-Seaidy. Thanks!
IF (Today() <= AddYears([stat_date],1),'0 Years ',
Age(Today(),[stat_date]) & ' Years ')
&
IF(MONTH(Today()) = MONTH([stat_date]),'0 Months ',
IF(DAY([stat_date]) < DAY(Today()), fabs(MONTH(Today())-Month([stat_date])) & ' Months ',
((
MONTH(Today())+12)-Month(stat_date))-1  & ' Months '
))
&
IF(MONTH(Today()) = MONTH(stat_date),DAY(Today()) - DAY(stat_date) & ' Days',
IF(DAY(Today()) > DAY(stat_date),DAY(Today()) - DAY(stat_date) & ' Days',
DAY(DATE(Interval(Today() - stat_date)))-1 & ' Days'
))
As PortfolioAge

Resident MCAZAprroved;

I get an error message, Table not found.

Please assist

Regards.

1 Solution

Accepted Solutions
ali_hijazi
Partner - Master II
Partner - Master II

either rename your Table as MCAZAprroved

or use resident [MCAZAprroved]

the brackets are part of the name of your table

I can walk on water when it freezes

View solution in original post

10 Replies
ali_hijazi
Partner - Master II
Partner - Master II

either rename your Table as MCAZAprroved

or use resident [MCAZAprroved]

the brackets are part of the name of your table

I can walk on water when it freezes
Chanty4u
MVP
MVP

may be

mising the brakets of ur  table name

MayilVahanan

Hi

Please check "PharmaMarketAudit.dbo.tblMCAZRegister" is available or not?


Can you post the error message screenshot?

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
sunny_talwar

I don't think square brackets matter here.

Although it would be helpful if you can post a screenshot of your error message

Anonymous
Not applicable
Author

Many thanks, that solved my problem

Chanty4u
MVP
MVP

Anonymous
Not applicable
Author

Many thanks Sunny, the issue was on brackets

Anonymous
Not applicable
Author

Many thanks, issue was on brackets

Anonymous
Not applicable
Author

Many thanks for your input, brackets was the issue