Forum Discussion
MStaford
1 year agoRegular Visitor
Text Comparision from multiple rows in the same column
Hi Everyone, Thankyou in advance for pardoning me for asking this questions and helping me with the solution. Situation - I am working on a solution to idenfity the change in text between two...
- 1 year ago
Hi MStaford
Your max is returning the biggest text NOT the last text by date.
I've used top to return the relative last date for the current date.
So each date is comparing to the one before etc
Colour TxtDiff = VAR CurrentItem = SELECTEDVALUE('sample-table'[Product-ID]) VAR CurrentDate = SELECTEDVALUE ('sample-table'[Date]) VAR CurrentText =SELECTEDVALUE ('sample-table'[Descriptions]) var PrevText = CALCULATE ( maxx( TOPN( 1, FILTER(all('sample-table'), 'sample-table'[Product-ID] = CurrentItem && 'sample-table'[Date] < CurrentDate),'sample-table'[Date],DESC) ,'sample-table'[Descriptions] )) var final = IF(NOT(ISBLANK(PrevText)) && PrevText <> CurrentText, "#FF000050", "#FFFFFF" ) RETURN final - Anonymous1 year ago
Hi MStaford
Please try this measure:
TxtDiff = VAR _currentDate = MAX ( 'Table'[Date] ) VAR _currentPD = SELECTEDVALUE ( 'Table'[Product-ID] ) VAR _previousdate = CALCULATE ( MAX ( 'Table'[Date] ), FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Date] < _currentDate && 'Table'[Product-ID] = _currentPD ) ) VAR _previousDescription = CALCULATE ( SELECTEDVALUE ( 'Table'[Descriptions] ), FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Product-ID] = _currentPD && 'Table'[Date] = _previousdate ) ) RETURN IF ( NOT ISBLANK ( _previousDescription ) && _previousDescription <> SELECTEDVALUE ( 'Table'[Descriptions] ), "text are different", "texts are the same" )The result is as follow:
Best Regards
Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
1 year agoNot applicable
Hi MStaford
Please try this measure:
TxtDiff =
VAR _currentDate =
MAX ( 'Table'[Date] )
VAR _currentPD =
SELECTEDVALUE ( 'Table'[Product-ID] )
VAR _previousdate =
CALCULATE (
MAX ( 'Table'[Date] ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[Date] < _currentDate
&& 'Table'[Product-ID] = _currentPD
)
)
VAR _previousDescription =
CALCULATE (
SELECTEDVALUE ( 'Table'[Descriptions] ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[Product-ID] = _currentPD
&& 'Table'[Date] = _previousdate
)
)
RETURN
IF (
NOT ISBLANK ( _previousDescription )
&& _previousDescription <> SELECTEDVALUE ( 'Table'[Descriptions] ),
"text are different",
"texts are the same"
)
The result is as follow:
Best Regards
Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.