Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Daniel1908
Creator
Creator

Compare 2 Values in different rows

Hello Together, 

currently I compare 2 Values from different rows. 
This works fine.

But now I want just to count the Material Number if the Text and the Price are equal to each other. 

For example in the below table only count Text = T-Shirt with Price 10,00€. 

Daniel1908_0-1620636522405.png

I am using the below in the script:


Left Join (Data)

Load
Text,

If(Count(Text)>1,1) as CountText

Resident Data

Group by Text;

 

Left Join (Data)

Load
"Price",

If(Count("Price")>1,1) as CountPrice

Resident Data

Group by "Price";

 

3 Replies
Dalton_Ruer
Support
Support

// Load the data
StockData:
Load * Inline [
Price, Text, MaterialNumber
10000, t-shirt, 93849
20000, pants, 93002
10000, t-shirt, 88493
30200, pants, 98390
20000, pants, 18837
23000, shirts, 93982
22000, skirts, 39820
22010, skirts, 3921983
];

// Go through data to find material numbers where the price and text are identical
Join
Load
Price, Text, MaterialNumber,
IF (Price = Previous(Price) and Text = Previous(Text), 'Yes', 'No') as MatchFound
resident StockData
order by Price, Text, MaterialNumber

Yields these results:

Dalton_Ruer_0-1620654166878.png

If it's a count you are looking for you can simply change Yes and No to 1 and 0. Or use Dual('Yes', 1), Dual('No', 0)

and then you could SUM the duplicatefound field for the count. 

Daniel1908
Creator
Creator
Author

The Matchfound worked.

Is it possible to show both as 'Yes'? 

Daniel1908_0-1621253014156.png

I would like to filter and show only the ones which are equal to each other.

Kind Regards, 
Daniel

 

Daniel1908
Creator
Creator
Author

Hello Together, 

I tried to use asc and desc, unfortunately without success. 

Order by Price, Text, MaterialNumber asc;

Order by Price, Text, MaterialNumber desc;

Is there any Idea how to show both Matchfound with "Yes"?

Kind Regards, 
Daniel