Forum Discussion
Problem with IF DAX Funtion!
- Anonymous2 years ago
Hi TrongPhuoc ,
Please try below steps:
1. create measure with below dax formula
Measure = VAR max_date = MAXX ( ALL ( 'Table' ), 'Table'[Date] ) VAR tmp = FILTER ( ALL ( 'Table' ), 'Table'[Date] = max_date ) VAR max_val = MAXX ( tmp, [CriticalVal] ) VAR _a = CALCULATETABLE ( VALUES ( 'Table'[order1] ), FILTER ( tmp, [CriticalVal] = max_val ) ) VAR cur_date = SELECTEDVALUE ( 'Table'[Date] ) VAR cur_order = SELECTEDVALUE ( 'Table'[order1] ) RETURN IF ( AND ( cur_date = max_date, cur_order IN _a ), 1 )Measure 2 = VAR max_date = MAXX ( ALL ( 'Table' ), 'Table'[Date] ) VAR tmp = FILTER ( ALL ( 'Table' ), 'Table'[Date] = max_date ) VAR max_val = MAXX ( tmp, [CriticalVal] ) RETURN IF ( MAX ( 'Table'[CriticalVal] ) = max_val, "red" )2. add table visual with fields
3. set visual level filter and conditional format for font color
Please refer the attached .pbix file.
Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. - 1 year ago
Thank you very much!
Hi Anonymous ,
Is it possible to execute my idea by using dax? It've been a while when I sent you my sample!
Best regards,
Trong-Phuoc Huynh
Hi TrongPhuoc ,
Please try below steps:
1. create measure with below dax formula
Measure =
VAR max_date =
MAXX ( ALL ( 'Table' ), 'Table'[Date] )
VAR tmp =
FILTER ( ALL ( 'Table' ), 'Table'[Date] = max_date )
VAR max_val =
MAXX ( tmp, [CriticalVal] )
VAR _a =
CALCULATETABLE (
VALUES ( 'Table'[order1] ),
FILTER ( tmp, [CriticalVal] = max_val )
)
VAR cur_date =
SELECTEDVALUE ( 'Table'[Date] )
VAR cur_order =
SELECTEDVALUE ( 'Table'[order1] )
RETURN
IF ( AND ( cur_date = max_date, cur_order IN _a ), 1 )
Measure 2 =
VAR max_date =
MAXX ( ALL ( 'Table' ), 'Table'[Date] )
VAR tmp =
FILTER ( ALL ( 'Table' ), 'Table'[Date] = max_date )
VAR max_val =
MAXX ( tmp, [CriticalVal] )
RETURN
IF ( MAX ( 'Table'[CriticalVal] ) = max_val, "red" )
2. add table visual with fields
3. set visual level filter and conditional format for font color
Please refer the attached .pbix file.
Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.