Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculation on above Dimensional Value

Hi - I have a straight table and like to check if the dimensional value matches the value above:  I've looked at the Above() function, but this seems to be for expressions and not dimensional values. 

Looking for something like this:

If (Person = Person on Previous Row, THEN Same, ELSE Different)

Eg:

RowPerson (Sorted Alphabetically)Dimensional Calculation
1David-
2JohnDifferent (to Row 1)
3JohnSame (as Row 2)
4JohnathanDifferent (to Row 3)
5SteveDifferent (to Row 4)
6SteveSame (as Row 5)

Help appreciated

Jay

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Screen shots above?

Load *, RowNo() as Row Inline [

Email

Person1@email.com

Person2@email.com

Person2@email.com

Person2@email.com

Person3@email.com

Person3@email.com

Person4@email.com

]

Straight table:

Calculated dimension: =Dual(Email, Row)

Expression: =If( Email=Above(Email), 'Same', 'Different')

View solution in original post

12 Replies
Anil_Babu_Samineni

As i understand, Use this? And, I always recommend you to create in script

Capture.PNG

LOAD Row,

     [Person (Sorted Alphabetically)],

     If(Row, Previous(Row)) as [Dimension Calculation]

FROM

[https://community.qlik.com/message/1271470]

(html, codepage is 1252, embedded labels, table is @1);

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Not applicable
Author

Hi Anil - that's not quite what I'm expecting...I added the Row column to help with the understanding of the problem.

Problem:

For the current row, I want to check the dimensional value of the previous row to determine if the same value.

Jay

Anil_Babu_Samineni

May be not understand fully? Would you tell us expected result, That may helps

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Not applicable
Author

hi - For simplicity, My qlikview straight table looks like this:  (The duplicates are expected and needed).

Email
Person1@email.com
Person2@email.com
Person2@email.com
Person2@email.com
Person3@email.com
Person3@email.com
Person4@email.com

I want this output:

EmailCheck
Person1@email.com
Person2@email.comDifferent
Person2@email.comSame
Person2@email.comSame
Person3@email.comDifferent
Person3@email.comSame
Person4@email.comDifferent

Thanks, Jay

tresesco
MVP
MVP

Like this?

Capture.PNG

Not applicable
Author

Tresesco B - Any chance you can put the code into a text file?  I'm running a personal edition today and unable to open the file

Thanks Jay

Anil_Babu_Samineni

If you are expecting same as Tresco suggestion, This may be

If(Email = Previous(Email),'Same','Different')

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
tresesco
MVP
MVP

Screen shots above?

Load *, RowNo() as Row Inline [

Email

Person1@email.com

Person2@email.com

Person2@email.com

Person2@email.com

Person3@email.com

Person3@email.com

Person4@email.com

]

Straight table:

Calculated dimension: =Dual(Email, Row)

Expression: =If( Email=Above(Email), 'Same', 'Different')

Not applicable
Author

'Previous' is not a valid function