Forum Discussion
Text Comparision from multiple rows in the same column
- 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.
Hi SamWiseOwl and Anonymous,
Thankyou for your posts and solutions. Please accept my apologies for delay in responding.
In desperation, I came across another solution which worked perfectly and I have applied it to my report.
I greatly appreciate your support and will be taking in the learnings from your suggessions.
Much appreciated your support and paitence.
Cheers