I was hoping someone could help with this DAX please:
I am trying to say if the required date is greater than the completion date and the days remaining is not null,then True else False.
I get an unexpected tuple error. They are two date columns and a whole number column for days remaining
Could anyone help please?
IF(AND(Column1[required date] > Column1[Completion date] NOT(ISBLANK(Column1[Days Remaining] , TRUE, False)
Thank you anyone for any help.
IF(
AND(
Column1[required date] > Column1[Completion date]
,NOT(ISBLANK(Column1[Days Remaining]))
)
,TRUE
,False
)
Related
Respected all I want to bring data from a dated column with input of a Month like I have a column in database which type is dated but I want data only mentioning just month and year I tried but got errors please check my query
SELECT
M.INV_NUM, M.GD_NUM, M.INV_DATE, M.QTY1,
D.ITEM_CODE, D.HS_CODE, R.QNTY, R.waste_per,
R.WASTE_QNTY, (R.WASTE_QNTY+R.QNTY) TOTAL_CONSUMED
FROM
DOCT_EXPT_SALE_MST M,
DOCT_EXPT_SALE_RAW R,
DOCT_EXPT_SALE_DTL D
WHERE
R.SALE_DET_ID = D.SALE_DET_ID
AND D.SALE_ID = M.SALE_ID
AND M.INV_DATE BETWEEN TO_DATE(TRUNC('072022','MMYYYY')) AND TO_DATE(TRUNC('072022','MMYYYY'))--TO_NUMBER(TO_DATE(TO_CHAR('01072022','DDMMYYYY'))) AND TO_NUMBER(TO_DATE(TO_CHAR('31072022','DDMMYYYY')))
AND M.COMP_CODE = 3;
I tried many things but all is gone in vain. If anybody help me on this, I shall be very thankful my database is 11g
If you are being passed the string '072022' then you can do:
AND M.INV_DATE >= TO_DATE('072022','MMYYYY')
AND M.INV_DATE < ADD_MONTHS(TO_DATE('072022','MMYYYY'), 1)
The TO_DATE('072022','MMYYYY') clause will give you midnight on the first day of that month, so 2022-07-01 00:00:00.
The ADD_MONTHS(TO_DATE('072022','MMYYYY'), 1) clause will take that date and add one month, giving 2022-08-01 00:00:00.
The two comparisons will then find all dates in your column which are greater than or equal to 2022-07-01 00:00:00, and less that 2022-08-01 00:00:00 - which is all possible dates and times during that month.
So your query would be (switching to ANSI joins!):
SELECT
M.INV_NUM, M.GD_NUM, M.INV_DATE, M.QTY1,
D.ITEM_CODE, D.HS_CODE, R.QNTY, R.waste_per,
R.WASTE_QNTY, (R.WASTE_QNTY+R.QNTY) TOTAL_CONSUMED
FROM
DOCT_EXPT_SALE_MST M
JOIN
DOCT_EXPT_SALE_DTL D ON D.SALE_ID = M.SALE_ID
JOIN
DOCT_EXPT_SALE_RAW R ON R.SALE_DET_ID = D.SALE_DET_ID
WHERE
M.INV_DATE >= TO_DATE('072022','MMYYYY')
AND M.INV_DATE < ADD_MONTHS(TO_DATE('072022','MMYYYY'), 1)
AND M.COMP_CODE = 3;
Table 1 (Combined Hours) I have a list of [payweek], which is many repeated
Table 2 (All Scripts), I have a list of jobs and two dates, [Scripting Date] and [R4PreScriptDate]
I am trying to find the number of unique [payweek]s between the [Scripting Date] and the [R4PreScriptDate]
The DAX formula is below. My result is always 3. However, I am expecting variable answers (0,1, 2,3,4 or 5)
R4PreScriptWkCt = CALCULATE(DISTINCTCOUNTNOBLANK(CombinedHours[payWeek]),FILTER(CombinedHours,
CombinedHours[payWeek] <= MAX (AllScripts[Scripting Date] )
&& CombinedHours[payWeek] >= MAX (AllScripts[R4PreScriptDate] ) ))
Thank you,
I assumed that both tables are related by Job Number. I created the following measure:
R4PreScriptWkCt =
VAR __date2 = MAX ( AllScripts[R4PreScriptDate] )
VAR __date1 = MAX ( AllScripts[Scripting Date] )
VAR __job = MAX ( AllScripts[Job Number] )
VAR __subTable =
FILTER (
CombinedHours,
CombinedHours[Job Number] = __job
&& CombinedHours[Week] >= __date1
&& CombinedHours[Week] <= __date2
)
RETURN
CALCULATE ( DISTINCTCOUNTNOBLANK ( CombinedHours[Week] ), __subTable )
Hope it helps you.
I'm using DaxStudio to test some measures, but am having trouble getting them to work. I can run the following expression, but don't know how to run an average of the field Mean to show just the mean of that. I'm basically expecting output to be a single cell with the average.
DAX Query:
EVALUATE
FILTER(
NATURALINNERJOIN(Alldata, NATURALINNERJOIN('Label', NATURALINNERJOIN('LabelBSkill', 'LabelCSkill'))),
'LabelCSkill'[Name] = "Critical"
&& 'Label'[Type]="Red"
)
Mean is in the table Alldata if that matters
Give this a try:
EVALUATE
ROW (
"Mean", CALCULATE (
AVERAGE ( Alldata[Mean] ),
'LabelCSkill'[Name] = "Critical",
'Label'[Type] = "Red"
)
)
I have a custom calculation using the number of days.
<= 5 and my DAX calc is =[Total Days Aged]<=5
=6 and <=10 and my DAX calc is =([Total Days Aged]<=10)&&([Total Days Aged]>=6)
My calculation are above which are returning 'True' or 'False expressions. How can I calculate the total number of 'true' values in the column?
I've tried the following and the IF function, but I can't get it to work.
=calculate(DISTINCTCOUNT(Query[0-5 Days]), Query[0-5 Days] = "True")
=CALCULATE(DISTINCT(Query[0-5 Days]), Query[0-5 Days] = "True")
My error message is: "DAX comparison operations do not support comparing values type of true/false of values with type text."
Thanks in advance,
It looks like you are trying to compare a logical true/false with a string. You should try replacing the string "True" in the query with logical value TRUE(). Try the query below.
=CALCULATE(DISTINCT(Query[0-5 Days]), Query[0-5 Days] = TRUE() )
I've to calculate the différence between two Dates : TODAY() and DATE_DEB_VAC.
With Oracle, it's kinda easy : TODAY()-DATE_DEB_VAC -> give the number of day between those 2 date.
But I've to do it with in an ETL (GENIO). I've a column to stock it like that :
NUMBER_DAY_DIFF (NUMBER 10) = TODAY()-DATE_DEB_VAC. But it's impossible to stock it cause it's 2 date.
How can i do this ? :(
You can try the val function of GENIO ETL
VAL(TODAY()-DATE_DEB_VAC)
this is equivalent to to_numbre in Oracle
NUMBER_DAY_DIFF (NUMBER 10) = DATEDIFF (TODAY; DATE_DEB_VAC)
Should give you what you need.