Forum Discussion
PBI_Curve
7 years agoHelper I
Conditional Formatting - One Date's Values Based Another Date's Value
Hi Guys, I'm creating a fairly basic table listing sales totals per salesperson, over time - as below. There are 3 fields: Date, Sales and Salesperson, that make up this table. What I would l...
- Anonymous7 years ago
Hi PBI_Curve,
I'd like to suggest you write a measure to calculate the diff between date and return color string based on result, then you can simply use above measure as conditional format field of value column.
Measure = VAR currPerson = SELECTEDVALUE ( 'Table'[Person] ) VAR currDate = MAX ( 'Table'[Date] ) VAR prevDate = CALCULATE ( MAX ( 'Table'[Date] ), FILTER ( ALLSELECTED ( 'Table' ), [Date] < currDate ) ) VAR diff = LOOKUPVALUE ( 'Table'[Amount], 'Table'[Person], currPerson, 'Table'[Date], currDate ) - LOOKUPVALUE ( 'Table'[Amount], 'Table'[Person], currPerson, 'Table'[Date], prevDate ) RETURN IF ( diff > 0, "Green", IF ( diff = 0, "Orange", "Red" ) )Regards.
Xiaoxin Sheng
Anonymous
7 years agoNot applicable
Hi PBI_Curve,
I'd like to suggest you write a measure to calculate the diff between date and return color string based on result, then you can simply use above measure as conditional format field of value column.
Measure =
VAR currPerson =
SELECTEDVALUE ( 'Table'[Person] )
VAR currDate =
MAX ( 'Table'[Date] )
VAR prevDate =
CALCULATE (
MAX ( 'Table'[Date] ),
FILTER ( ALLSELECTED ( 'Table' ), [Date] < currDate )
)
VAR diff =
LOOKUPVALUE (
'Table'[Amount],
'Table'[Person], currPerson,
'Table'[Date], currDate
)
- LOOKUPVALUE (
'Table'[Amount],
'Table'[Person], currPerson,
'Table'[Date], prevDate
)
RETURN
IF ( diff > 0, "Green", IF ( diff = 0, "Orange", "Red" ) )
Regards.
Xiaoxin Sheng
PBI_Curve
7 years agoHelper I
Anonymous worked a charm.
Thanks!