spotfire calculations in the same column - spotfire

I'm a beginner in spotfire and I wouldlike to insert a column that will calculate for each clients of my table the difference between the date of an operation and the previous date of operation.
In the example below, I describe what I expected in the "difference column"
Example of what I Expect:

#user8797355- The below custom expression will give you the desired result.
Days([Date of Operation] - max([Date of Operation]) over (intersect(previous([Date of Operation]),[Client])))
Note: The output is in days.
Here is the test output:
Hope this helps!

Related

creating new column in excel based on conditions from two columns

What formulas can I use in excel to compute column D while simultaneously matching on column A,B and C.
If the case id is the same and date is the same, then if status is approved, final status is approved. but if case id is same date is same, and if status is denied, then final status is partial denial.
Can someone please help?
I tried do if and statement but I don't know how to match on unique case IDs in the same column.
It appears there is some missing information in your query. Let me write it out similar to an Excel IF statement:
=IF(CaseSame,IF(DateSame,IF(APPR,Appr,IF(DENY,PtDeny,??)),??),??)
With the information given, we don't know what to do in all outcomes. The outcomes marked with "??" will show as FALSE, because there is no output given for those criteria. But that formula would look like this:
=IF(A2=OFFSET(A2,-1,0),IF(B2=OFFSET(B2,-1,0),IF(C2="APPROVED","Approved",IF(C2="DENIED","Partial Denial",FALSE)),FALSE),FALSE)
And even there, I'm having to make the assumptions that you intend to go off the data in the row above for "case ID is the same" and "date is the same".
Are we supposed to assume that if no other criteria is given, to use column C's answer? In that case, there is still one unknown outcome in the IF statement:
=IF(C2="APPROVED","Approved",IF(C2="DENIED","Partial Denial",FALSE))
As long as no other entry is made in Column C, that should provide consistent results.
Here are what the two statements render in the Final Status column:
Results of both IF statements against your data and instructions
I hope this helps. With clearer information what to do in all circumstances, I may be able to provide a better answer.

Countif dates in two table columns are different

I have a bit of an issue. Why else would I be here? ;)
I have a table (table1) and in this table I have two columns that I would like to count if the dates differ (Task due date and Task complete date). What I want to do is calculate the task that are past due or delivered on time. (Yes I am aware that free templates are available, this is mainly to learn more on working with Excel)
In my calculation sheet, I want to count:
The amount of Task complete dates that are prior or equal (<=) then the Task due date
The amount of Task complete dates that are past (>) the Task due date
I think that the issue lays in in the COUNTIF statement because it seems to only accept one array (the count array) after that comes the criteria which does not seem to handle arrays.
I also tried =SUMPRODUCT(COUNTIF(Table1[Task complete date];"<=" & Table1[Task due date])) But this gives me a value of 8 (while I have two possible matches)
According to This tutorial, I should get a return value of 1 and 0 but looking at the calculation steps I get: SUMPRODUCT({1;1;2;2;2;0;0;0;0;0}) This would off course be where the value of 8 comes from.
Is there any way around this? Do I need to add in some kind of if statement or some kind of pre-check?
Here is a link to the excel document with some test data
Oh and by the way: the comma delimitter in my country is a ; and not an actual comma. That is why there are semicolumns where some of you would expect a comma.
Any help would be greatly appreciated. Thank you all in advance.
Tinus
You could add a date check to column M in your "Project tasks" table: =IF(COUNTBLANK(F4)+COUNTBLANK(K4)=0,IF([#[Task due date]]<=[#[Task complete date]],"On time","Past Due"),"").
Then you could use =COUNTIF(Table1[Date check],[#[on time/past due]]) in column K of your "Data" sheet.
P.S. If you need a translation of the given function you may check https://de.excel-translator.de/
The reason that you are getting values above 1 is that your COUNTIF is actually comparing each value in Table1[Task complete date] to each value in Table1[Task due date]. e.g. if the [Task complete date] is 1 Jan, it will count how many [Task due date] values are greater than or equal to 1 Jan, so that could be 2, for example. Then it moves to the next value in [Task complete date] and does the same.
So you would need to do:
The amount of Task complete dates that are prior or equal (<=) then the Task due date
=SUM(--(Table1[Task complete date]<=Table1[Task due date]))
The amount of Task complete dates that are past (>) the Task due date
=SUM(--(Table1[Task complete date]>Table1[Task due date]))
Additional Notes
For versions of Excel before 2019 or Excel 365, the formulas above must be entered as array formulas, so you have to enter them with CTRL+SHIFT+ENTER. For your Google Sheets version, these must also be array formulas, but you will also need some additional filtering to get it to ignore blank cells. You could do:
=ArrayFormula(SUM((K4:K24<=F4:F24)*(K4:K24>0)))
and
=ArrayFormula(SUM((K4:K24>F4:F24)*(K4:K24>0)))

Add x Days to a Date Based on vlookup Output Excel

What I'm trying to do is give a due date based on an input date, type of review, and department.
For example if the department is ABC and the review is retrospective, the due date will be the input date + 30 days.
But if the department is ABC and the review is concurrent, then the due date will be input date + 1 day.
I know I can concatenate the department and review into the vlookup table but I'm not so sure how to get the output to be the due date that I want.
Can anyone help?
EDIT:
Per the first answer below, I hashed out an input table with concatenated columns just in case I needed them. It is a bit more complicated than I originally thought.
Input table with date logic
I'd love to simply edit the source data but the report isn't readily available in the database. Could I still use the suggestions below?
Assuming you have a lookup table for the number of days to add depending upon the department and review type similar to the one below, you can use an INDEX/MATCH/MATCH and simply add it to the input date:
=$A2+INDEX($H$4:$J$5,MATCH($B2,$G$4:$G$5,0),MATCH($C2,$H$3:$J$3,0))
SOLUTION FOR AN ALTERNATIVE LOOKUP TABLE LAYOUT
If your layout table is more like as below, you can use a MINIFS formula (or MAXIFS if you would prefer):
=$A2+MINIFS($I$3:$I$8,$G$3:$G$8,$B2,$H$3:$H$8,$C2)

Count and sum unique Values POwer BI

I'm trying to get the sum of Sales with uniuqe Catatery i'm using DAX Formula below
Countoracle = CALCULATE(SUM('Data Source'[Sales) ,DISTINCTCOUNT ('Data Source'[ItemAr]))
getting error
The True/False expression does not specify a column. Each True/False expressions used as a table filter expression must refer to exactly one column.
You are looking at it the wrong way.
Rather than cramming it into one measure try breaking them into 2 parts.
And please elaborate your question. What is your goal here ?

PowerPivot RANKX Function not working

I am trying to rank the values in a calculated field called PMPM in powerpivot. The formula I'm using is
RANKX(ALLSELECTED(Cost),[PMPM],,TRUE(),Dense)
but the results are wrong. Sample data here
The first column PMPM contains the fields I want to rank, PMPM2 contains the correct ranking that I put in manually for comparison. PMPMRank is the calculated field for which I use the formula above, but I don't get the correct results.
I'd appreciate any help! Thanks!
=IF(N(D2),INDEX($B$2:$B$2900,SMALL(IF($A$2:$A$2900=D2,ROW($B$2:$B$2900)-ROW($B$2)+1),COUNTIF(D$2:D2,D2))),"")
Make sure to press CTRL + ENTER otherwise this formula will not work.
Your formula works for me...?
Incidentally, your sample data is very strange - the ranking for >10 rank miss out some steps. e.g. rank 11. This isn't skip behaviour either (from what I can see of your sample data).
If you want to change the skip/dense behaviour in PP, you can insert an IF() function to choose how it behaves. For example, the below forces the RANKX column to change to SKIP instead of DENSE after the 10th ranking...
=
if(
RANKX('table',[PMPM],,TRUE(),DENSE)<=10
,RANKX('table',[PMPM],,TRUE(),DENSE)
,RANKX('table',[PMPM],,TRUE(),SKIP)
)
These are the results I get for the "dynamic" skip dense behaviour change

Resources