Forum Discussion
POSPOS
2 years agoPost Partisan
Conditional columns using DAX in Power BI
HI All, I have a requirement to display a new column based on a two other columns from the same table. Scenario: For each contract no., look for the minimum 'contract received date' and then di...
- 2 years ago
and you can try this
DateNew2 = VAR t1 = 'Table'[Contract No.] VAR t2 = ALLEXCEPT( 'Table', 'Table'[Contract No.] ) VAR t3 = CALCULATE( MIN( 'Table'[Contract Received date] ),t2 ) RETURN CALCULATE(MIN('Table'[Contract Executed Date]),t2, 'Table'[Contract No.] = t1 && 'Table'[Contract Received date] = t3 )
Ahmedx
2 years agoSuper User
and you can try this
DateNew2 =
VAR t1 = 'Table'[Contract No.]
VAR t2 = ALLEXCEPT( 'Table', 'Table'[Contract No.] )
VAR t3 = CALCULATE( MIN( 'Table'[Contract Received date] ),t2 )
RETURN
CALCULATE(MIN('Table'[Contract Executed Date]),t2,
'Table'[Contract No.] = t1 && 'Table'[Contract Received date] = t3
)Ahmedx
2 years agoSuper User
sorry you can shorten the code further try this
DateNew2 =
VAR t1 = 'Table'[Contract No.]
VAR t2 = ALLEXCEPT( 'Table', 'Table'[Contract No.] )
VAR t3 = CALCULATE( MIN( 'Table'[Contract Received date] ),t2 )
RETURN
CALCULATE(
MIN('Table'[Contract Executed Date]),t2,
'Table'[Contract Received date] = t3
)
- POSPOS2 years agoPost Partisan
This worked too! thank you for the solution