简体   繁体   中英

Spotfire Calculated Column

I am new to Spotfire and I hope you can help. I have a Excel sheet in excess of 280,000 rows hence my Excel sheet becomes EXTREMELY slow when I run my formula. I was hoping Spotfire could help. What I am trying to achieve is this: A Doctor is paid a certain amount in 2015 and then the exact same amount is taken back in 2016. I am looking to identify these paid in 2015 and taken back in 2016 transactions only from the 280,000 rows. The below pic shows and example of the positive and negative in Excel. 在此处输入图片说明

Using Columns D,L,N & JI used a SUMIFS Formula to identify in Column O The Positive and Negative transactions which offset to Zero. Can Spotfire achieve the same thing in a calculated column without the SLOWING of the Computer?

Below is what i Have so far in Spotfire not much but i am very new and the Synax is new to me. 在此处输入图片说明 Can a calculated column go in after the date column and identify the Positive and Negative for 2015 and 2016 that offset to zero? Any help would be greatly appreciated. Thank you

First step 在此处输入图片说明

Nothing came back in the 3rd column 在此处输入图片说明

This is the formula i used to achieve what i needed in excel its long takes ages to process but it works. can we adopt this formula to Spotfire? 在此处输入图片说明

You can achieve this by aggregating with an over clause. If you can paste a text version of your data set then we can make sure we get it 100% right, but here is about what you want.

Get the sum for the year 2015 for each customer. This formula states if the year of the Payment is 2015, then sum all of the Amount column and group by the CustomerID.

If(DatePart("year",[Date of Payment])=2015,Sum([Amount]) OVER ([CustomerID])) as [2015CustomerTotal]

Get the sum for year 2016 for each customer

If(DatePart("year",[Date of Payment])=2016,Sum([Amount]) OVER ([CustomerID])) as [2016CustomerTotal]

Then you can check if they zero out.

If([2016CustomerAmount] - [2015CustomerAmount] = 0,True,False)

So i got the following to work (V proud of myself)

If(DatePart("year",[Date of Payment])=2015, True,False)

To continue on from above I need to know that when there is a negative in 2016 and it matches a Positive in 2015 for the amount and the [Nature] and [customer id] column ids match then return me "GOT YOU" or "1" :-) any help would be greatly appreciated.

Don't know why this is not working

CASE WHEN ([Amount]>0) AND (DatePart("year",[Date of Payment])=2015) Then "GOT YA"

figured it out

CASE WHEN [Amount]>0 AND (DatePart("year",[Date of Payment])=2015) Then "GOT YA" else "No GOT" end

Ok so we are getting somewhere I feel :-) So the below is now telling me where there was a payment in 2015

CASE WHEN [Amount]>0 AND (DatePart("year",[Date of Payment])=2015) Then "1" else "0" end

and the below here is now telling me where there was a -negative amount or money taken back in 2016

CASE WHEN [Amount]<0 AND (DatePart("year",[Date of Payment])=2016) Then "1" else "0" end

Ok so i have added a visual to better describe my issue. What i would like the custom function to do is: Where there is a 1 in [Pay in 2015] and a 1 in [reimburse in 2016] and the [customer id] remains the same and the 1s from [Pay in 2015] and the 1s from [reimburse 2016] offset the [amount] column to zero then show me "1" else "0" in a new column 在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM