convert rows into Column informatica - informatica

could you please let me know how to transform the rows into Column in powerCenter?
attached the Snapshot below.

All you need is an aggregator - group by Product and add two output ports to calculate the product value:
Current_value - MAX(IIF(end date = 1231999, Value, NULL))
Future_value - MAX(IIF(end date = 01010001, Value, NULL))
UPDATE:
PowerCenter aggregate functions take an optional filter_condition parameter, so you can also use the equivalent, more concise syntax:
Current_value - FIRST(Value, end date = 1231999)
Future_value - FIRST(Value, end date = 01010001)

Related

DRUID SQL LATEST() and EARLIEST() returning zero

I have this data source in druid:
I'm trying to use LATEST() to return the latest coordinates of each user active in the last minute. My intention is to show their location in realtime using a mapbox chart in superset. This is my query:
SELECT LATEST(latitude), LATEST(longitude), user_id FROM locations
WHERE __time >= CURRENT_TIMESTAMP - INTERVAL '1' minute
GROUP BY user_id
The problem is that LATEST() always return zero. Does anybody know what I'm doing wrong and how to achieve what I want using DRUID SQL?
LATEST(expr) returns the latest value of expr, which must be numeric.
If your columns is not numeric, use LATEST(expr, maxBytesPerString)
e.g:
SELECT LATEST(latitude,16), LATEST(longitude,16), user_id FROM locations
WHERE __time >= CURRENT_TIMESTAMP - INTERVAL '1' minute
GROUP BY user_id

Find difference between two rows by usind Dax in Power BI

I have three column one is Id(ID is same) 2nd col is amount and third is date, I want difference between two rows(amount)
As you want to have the previous value of the date where the ID is equal, you can use the following:
Add a column,
Column4 =
var baseFilter = FILTER(DiffRows;DiffRows[Column1] = EARLIER(DiffRows[Column1]))
var selectDate = CALCULATE(LASTDATE(DiffRows[Column3]);baseFilter;
FILTER(baseFilter; DiffRows[Column3] < EARLIER(DiffRows[Column3])))
return
DiffRows[Column2] - CALCULATE(sum(DiffRows[Column2]);baseFilter;
FILTER(baseFilter; DiffRows[Column3] =selectDate))
First I create a basefilter to ensure the IDs are same.
Next I select the date whcih is the previousdate within the set of same ids
Last I use this date, to filter the correct value out of the rows.
End result:

Google Sheet Formula for finding an element across multiple tabs

I`m trying to populate values in column F, "Product Sold Date" in "TABLES" tab
Basically... the logic is as follows:
1) If Column C (Product Status) = "Paused", then return "Paused"
2) If Product start date = NULL or Product end date = NULL, then return NULL
3) If Product start date < today`s date, then return "No Data"
4) If Product start date >= today`s date, return "Upcoming"
5) If product End date <= today`s date, return "Ended"
6) If product start date <= today`s date, return "In Market"
7) If the condition does not belong to any of the above cases, then return the actual Product launch dates
Below is the link to the sample data I`m working on..
I`m pasting the link itself, becaues there are multiple tabs included
https://docs.google.com/spreadsheets/d/120rHOt8Pa_PdMKPgLkSYOKTO2Cv1hBH6PpTrg7FfJLk/edit?usp=sharing
Ultimately, I need to populate the actual "Product Launch Date" by scanning data in each tab
I tried using nested if statements with combination of Index Match.
But I`m totally lost in case of multiple tabs
Can anyone please provide suggestion on this?
Should we think about using query statements instead in this case?
Sidenote: The returned values will be mix of dates and character
[In market/ Ended/ Upcoming/ No Data/ NULL/ Paused/ Actual Date]
=ARRAYFORMULA(
IF(C2:C="Paused", C2:C,
IF((A2:A="")+(B2:B=""), ,
IF(A2:A >= TODAY(), "Upcoming",
IF(B2:B <= TODAY(), "Ended",
IF(A2:A = TODAY(), "In Market",
IF(E2:E<>"", IFERROR(VLOOKUP(D2:D&E2:E,
{'Eaton Centre'!A2:A &"Eaton Centre", 'Eaton Centre'!B2:B;
'Yorkdale Mall'!A2:A&"Yorkdale Mall", 'Yorkdale Mall'!B2:B;
'Vaughan Mills'!A2:A&"Vaughan Mills", 'Vaughan Mills'!B2:B}, 2, 0)), )))))))
Your formula would be
=IF(C2="Paused",C2,if(OR(A2="",B2=""),"",IF(A2<TODAY(),"No Data",IF(A2>=TODAY(),"Upcoming",IF(B2<=TODAY(),"Ended",IF(A2<=TODAY(),"In Market","Actual Product Launch dates"))))))
In the above formula, you should be using a Query formula in place of "Actual Product Launch dates", to extract the actual date.
But the points 3 & 6 don't make any sense. The 6th condtion should be If product start date = todays date, return "In Market"

how to pick maximum date from a group of dates coming through source,other than high date?

I have around 7 fields coming from source. I need to pick the highest date of them all in an informatica expression. I may also get a default high date (12/31/9999) in any fields, but if that date shows up in any of the fields , then that has to be skipped in comparison.
e.g, if my source fields have data - 1/1/2001 , 1/2/2002, 2/2,2003, 12/31/999.
Then my expression output has to be 2/2/2003.
Create additional port that will discard the default, like
agg_Date = IIF(in_Date = '12/31/9999', NULL, in_Date)
Now use agg_Date in Aggregator Transformation to calculate MAX.
You can do it on SQ level ( custom sql query ) or Informatica level :
https://forgetcode.com/informatica/1472-greatest-find-greatest-value
Step 1:
Define check for each field ( or do it inline )
DATE_1_CHECKED = IIF( DATE_1 = TO_DATE('9999.. ', 'YYYY-' ), NULL, DATE_1)
Step 2:
GREATEST(DATE_1, DATE_2, DATE_3 )
ps. I'm not sure about casting function TO_DATE, please read doc.
ps. If You want to cut precission of date/time in informatica, please use trim(DATE_1, 'DD') to get date with HH24:MM:SS zero filled.
write an IIF to compare the date values using < , > and output the greatest one and !=12/31/999

Need to help build a control column that finds a bug with DAX

Power BI Desktop, DAX
I need to help build a control column that finds a bug.
I have three columns: "SN" - serien nr. Data type: text, "MTH" Type data: Whole Number and "Date" Data type: Date.
Each SN has x Mth. Every Mth has just one date.
For each SN, it is true that it can not have more Mth at an earlier date.
Example:
I solved it only by counting the help tables in Query Editor, which took a lot of performance.
I was able to achieve this using the following calculated column:
Control =
VAR BugSN = Bug[SN]
VAR BugMth = Bug[Mth]
VAR BugDate = Bug[Date]
RETURN CALCULATE(
MAX(Bug[Date]),
ALL(Bug), Bug[SN] = BugSN, Bug[Mth] = BugMth
) = BugDate
What this says is that if the date in that row is the max for that SN and Mth combination, then TRUE otherwise FALSE.
(I named the table Bug, but you'll need to replace that with whatever your table name is.)