Forum Discussion
Jatin77
Helper I
3 years agoCondition based dax situation
Hello! I have a following data and I want to write a dax: ID name subject test date check date O/p 1 A Math 11/1/2015 5/2/2015 retake the test 1 A Science 12/1/2015 retake...
- 3 years ago
Hi Jatin77 ,
You can try this method:
O/p = VAR _BlankT = CALCULATE ( MAX ( 'Table'[test date] ), FILTER ( 'Table', 'Table'[ID] = EARLIER ( 'Table'[ID] ) ) ) VAR _BlankC = CALCULATE ( MAX ( 'Table'[test date] ), FILTER ( 'Table', 'Table'[ID] = EARLIER ( 'Table'[ID] ) ) ) VAR _CountT = CALCULATE ( COUNTA ( 'Table'[test date] ), ALLEXCEPT ( 'Table', 'Table'[ID] ) ) VAR _CountC = CALCULATE ( COUNTA ( 'Table'[check date] ), ALLEXCEPT ( 'Table', 'Table'[ID] ) ) VAR _TotalCountID = CALCULATE ( COUNTROWS ( 'Table' ), ALLEXCEPT ( 'Table', 'Table'[ID] ) ) RETURN SWITCH ( TRUE (), _BlankC = BLANK () && _BlankT = BLANK (), "test pending", _CountT <> _TotalCountID || _CountC <> _TotalCountID, "retake the test", _CountT = _TotalCountID && _CountC = _TotalCountID && 'Table'[check date] <= 'Table'[test date], "check pending", BLANK (), "N/A" )The result is:
Hope this helps you.
Here is my PBIX file.
Best Regards,
Community Support Team _Yinliw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.