How to remove 3 months from a date column in DAX [closed] - sorting

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 months ago.
Improve this question
I was wondering if you can help with below
I need to write have a conditional column for 3 month prior to review date
So, I have "review dates" column which contains review dates, and need something along the lines of "IF 3 months left before "Review Date" them then ALERT, otherwise NO ALERT"
Ideally to have rolling code so I don't have to alter it manually every time dates change
Any help will be greatly appreciated
Not sure how to approach

Yeap, I guess you can! but compare against what ? Today's date? If It is so, then Please create a new calculated column, and try this code! let me know If It is what you are looking for!
Logical_Result =
VAR NowIsTheTime =
NOW ()
RETURN
IF (
DATEDIFF ( YourTable[ReviewDate], NowIsTheTime, MONTH ) < 3,
"ALERT",
"NO ALERT"
)
If we test it on a table as column, It gives us:

Related

PowerPivot DAX Date Lookup

Would appreciate any help with this, I have a PowerPivot table, and I want to add a Dax column to find the sale by customer the previous week, for each customer on date dd/mm/yy find the value for (dd/mm/yy-7days). Example of what it would be in Excel using SUMIFS, not sure if possible in DAX ? Thanks in advance for your help. Gav
The right way to do any time intelligence calculations is to use a date table or as we call it date dimension. However, I imagine you need this for a quick "non model" calculation, so that case you can use the following DAX:
=
VAR DD =Table1[Date] - 7
RETURN
CALCULATE (
FIRSTNONBLANK( Table1[Value] , 1 ),
FILTER (
Table1,
Table1[Date] = DD
)
)
If this is the answer you were looking, please do not forget to mark this question as answered.

Next 6 months Data In OBIEE

I want to display Next 6 months Data from Current Month in OBIEE 11g.I tried with addmonths() but it shows all years in data,and if i filter on current year it will not shows months in next year.
It all depends - and that why someone voted down your question; it's just not very precise.
What do you want to compare it with? A month number? A month name?
Do you have what's needed? Do you have a properly formed time dimension?
The unclean approach is to use TIMESTAMPADD butwith that you're just curing the symptom, not the root cause.
TIMESTAMPADD(SQL_TSI_MONTH, 6, NOW())

Evaluating a program performance [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I have to develop an ABAP report program. After it's execution, I have to display a popup with evaluating it's performance. It's possible? I mean without using transaction SAT.
The scenario is simple:
1) Run report from se38 or it's using related tcode
2) After running - display the performance.
Please give me any idea how to do that. Thank you.
I assume that you want to measure the runtime of the report.
So, you could easily save the timestamp of the beginning of the program into an variable and when the execution logic finished, you can get another timestamp.
If you subtract timestamp 1 from timestamp 2, you have your running time.
For simple measurements you can you this snippet:
DATA: t1 TYPE i,
t2 TYPE i.
DATA: gt_tabrows TYPE TABLE OF exp_tablrows,
toff TYPE p DECIMALS 2.
GET RUN TIME FIELD t1.
SELECT tabname
FROM dd02l
INTO CORRESPONDING FIELDS OF TABLE gt_tabrows
WHERE tabname LIKE 'Y%'.
CALL FUNCTION 'EM_GET_NUMBER_OF_ENTRIES'
TABLES
it_tables = gt_tabrows.
GET RUN TIME FIELD t2.
toff = t2 - t1.
cl_demo_output=>new( )->begin_section(
|Y tables recordcount calculation:|
)->write_text(
| { toff } microseconds|
)->write_data( gt_tabrows )->display( ).
This sample outputs runtime of code calculating recordcounts of tables that start with Y.
If you run your programm in backgroup, the job-log gives you all your needed information.

How to create an error message in Visual Basic 6.0 when adding duplicate data to SQL Database? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I have a problem about my visual basic 6 program, I want to add an error message when a duplicate value is added by the user (I'm using SQL database). I tried a lot of codes but none of these works, I just deleted some of it. Here's the code. What code should I put to make it run? Please help, thanks in advance.
It is just a sample one, and I'm going to put the code to my original program if i am going to make it run.
You need to specify what do you consider as a duplicate line. A line with a IDNO that already exists or a line with IDNO and NAME that already exists?
Regardless the answer, you need to:
Define a unique key containing the fields that cannot have duplicate values. You must find out how to do that in your database management system. By doing that, you will have the guarantee that you will never have a duplicate line in your database.
Add a previous query to your code where you verify if there is a line in your table that already has the values you are trying to insert.
There are a number of ways to do this.
You could trap the error and check the error code/message, if it is "VIOLATION OF PRIMARY KEY CONSTRAINT" display the error message of your choice.
Personally I would check to see if it exists before the insert and if it does display the "The data you are trying to add already exists" message (or whatever it is you want to display).
On a side note you should look at Parameterized Queries. The query you have is open to SQL Injection. Take a look at this

Checking if date is before another date in PLSQL [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I'm still working on my university tasks and here I have to create trigger on table
MARRIAGE(ID_marriage, Date_of_wedding, Date_of_divorce);
which would work on UPDATE statement so that if someone tries to add or edit date_of_divorce it would make sure that it is AFTER date_of_wedding.
Here's how example of data looks:
ID_marriage | Date_of_wedding | Date_of_divorce
1 39/04/12 39/04/12
2 71/04/12 null
Now my question is how do I compare such dates in PL/SQL?
Thanks in advance!
No need for a trigger, a check constraint will work do:
alter table marriage
add constraint check_divorce
check (date_of_divorce is null or date_of_divorce > date_of_wedding);
As for the trigger, you need to compare the values of new.date_of_divorce and new.date_of_wedding - essentially the same condition as I have used in the check constraint. If the date_of_divorce is bigger you need to raise an exception to abort the insert or update statement.
As this is a school project, I won't give you the full code, you should find the correct syntax on your own.
The relevant chapters in the manual are:
http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/triggers.htm#LNPLS99955
http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/errors.htm#LNPLS00705
http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/triggers.htm#LNPLS781

Resources