I am using Informatica Analyst and am running a profile on a table data object, along with a rule on this profile. I need help with the syntax in IDQ to do this rule.
For example, in TABLE1 DOB. The column is DOB. I am trying to profile where the DOB is < 18 years old. The DOB is date time (mm/dd/yyyy 00:00:00).
This is my attempt:
TO_DATE(BIRTHDATE , 'mm/dd/yyyy') > TO_DATE(TO_CHAR(SYSDATE,'MM/DD,YYYY'),'MM/DD/YYYY')-18
But I'm seeing the following error:
The expression is not valid.
Difference between sysdate and birthdate should be > 18 years. Pls use this-
DATE_DIFF( SYSDATE, BIRTHDATE, 'Y' ) >18
Related
I am struggling to switch the Month number (1=Jan , 2=Feb , ... ) column into Months label(Jan , Feb. , Mar,... ) . My main problem is that am using direct query which poses a lot of restrictions on the DAX functions that I found can help with i am trying to do. Functions like FORMAT or SWITCH aren't supported and i tried using the MID function( MonthName = MID("xxJanFebMarAprMayJunJulAugSepOctNovDec",'public patient'[Month/Year]*3,3) which gave me an OLE DB folding error where I need to use a simpler expression. I've been researching with no progress. Any help would be appreciated.
Your best option is to join the date column in your fact table to a Calendar dimension table, on field [date].
Your calendar table can contain all the Date aggregations and labels you need (e.g. Month Name)
I have a table of Employees. The Table has both current and budgeted employees. Each employees has a salary, start date and if applicable a term date associated with them.
I am attempting for project the salary spend for each month for the next year based on the following rules:
Hire_Date <= Projected_Month
Term_Date > Projected_Month
Measure:
CALCULATE(sum(INPUT_TECH[Salary_USD]),filter(INPUT_TECH,INPUT_TECH[Hire_Date]<=MEASURE_SWB_SPEND[MEASURE_SWB_SPEND_DATE]&&INPUT_TECH[Term_Date]>MEASURE_SWB_SPEND[MEASURE_SWB_SPEND_DATE]))
The issue here is that if ther is no Term_date, the cell will be blank, and if the cell is blank, the term_date will always be less than the current projected month and therefore the answer will always be 0.
I attempted to fix this by changing the format of the termdate to always either have the number 100,000 formated to read "ACTIVE" or the date they were actually terminated
Format: [=100000]"ACTIVE";[<>100000]mm/dd/yyyy
However, I still receive the following error:
DAX comparison operations do not support comparing values of type Text with values of type Date. Consider using the VALUE or FORMAT function to convert one of the values.
I would suggest not formatting the term date to the string "Active" and then using it for comparisons in your measures. This is why you may be getting that specific error. DAX is finding a data-type issue when making the comparisons. If you want the term to show up as "Active" where term dates are blank for visualization reasons, that may be okay. But I would establish a new calculated column that determines if a term date is blank and replaces it with a date type far into the future so that dates can be compared among dates—something like:
Term Date Blank Fix =
IF(
ISBLANK( INPUT_TECH[Term_Date] ),
// The third argument below could be replaced with a hard year, ex. 2099
DATE( 12, 31, YEAR( TODAY() ) + 10 ),
INPUT_TECH[Term_Date]
)
Then you could use the above column to make your comparisons in your measures. Keep in mind that if you are using a date table with AUTOCALENDAR() that making a date with the year 2099 may wildly expand your date table.
Below is the data in csv file in s3 bucket which I have used to build Athena database.
John
Wright
cricket
25
Steve
Adams
football
30
I am able to run the query and get the data.
Now I am trying to fetch date of birth based on age column. Is it possible to generate date of birth from age column like current date - age (column) and print only the date of birth?
I tried below query but not sure whether it is correct way
select (current_date - interval age day) from table_name;
Please help me with this.
You can use the date_add function, like this:
SELECT date_add('year', -age, current_date) FROM table_name
I.e. subtract age number of 'year'(s) from the current date.
I have the data in the following format.
CompanyID Company Name
1 Nike
2 Adidas
3 Puma
I need to create a column and use it in X axis of a line chart or any visual for that matter in such a way that if a user from Nike logs in, in the visual he should "Nike" instead of companyID. But, for others he should the CompanyID.
Just add a new conditional column in Power Query or a computed column in DAX and use it instead of Company Name.
With Power Query:
With DAX:
Custom Company Name DAX = IF(Companies[CompanyID] = 1, Companies[Company Name], CONVERT(Companies[CompanyID], STRING))
Report data:
Report visuals:
I have a very simple question but since i am not familiar with SQL or PL/SQL, i got no idea to do that.
In my Oracle APEX Application, I am loading data from a table into a CLASSIC REPORT through setting Local Database/SQL Query as source.
I have to make 4 columns from data of 2 columns stored in a table. I can load 3 without any issue using the below simple statement:
Select TaskName, DueDate, DueDate - 3 as ReminderDate
from table_name
Fourth column should be "RemainingDays" which equals to DueDate-current date, I have tried writing DueDate - Sys_date and DueDate - current_date in the above statement to get the fourth column but probably its not the correct way as i get error instead of all 4 columns. (I am doing in it basic excel/dax way). Any Help here?
When you subtract a date from another date, Oracle returns a number which is the number of days between the two dates.
One thing to note when using SYSDATE or CURRENT_DATE is that you may get different results if your user is not in the same timezone as the database. SYSDATE returns the current time of the database. CURRENT_DATE returns the current time of the user whatever timezone they may be in.
If possible, try building the query in a tool such as SQL Developer, get it working there, then build your Classic Report in APEX. If you are still receiving an error, please share the error you are receiving as well as the query you are using.
Example
--Start of sample data
WITH
t (task_name, due_date)
AS
(SELECT 'task1', DATE '2020-9-30' FROM DUAL
UNION ALL
SELECT 'task2', DATE '2020-9-28' FROM DUAL)
--End of sample data
SELECT task_name,
due_date,
due_date - 3 AS reminder_date,
ROUND (due_date - SYSDATE,2) AS days_remaining
FROM t;
Result
TASK_NAME DUE_DATE REMINDER_DATE DAYS_REMAINING
____________ ____________ ________________ _________________
task1 30-SEP-20 27-SEP-20 13.66
task2 28-SEP-20 25-SEP-20 11.66