Forum Discussion
Anonymous
3 years agoNot applicable
Nested DAX iteration with multiple conditions
I am hopeful you will be able to help me or point me in the right direction to work out a DAX formula to return a calculated table. I have spend hours trying to figure it out but but have hit a wall...
- 3 years ago
Hi Anonymous
Please refer to attached sample file with the solutionTable 2 = SELECTCOLUMNS ( FILTER ( 'Table', VAR CurrentOfficeCustTable = CALCULATETABLE ( 'Table', ALLEXCEPT ( 'Table', 'Table'[Office], 'Table'[Customer] ) ) VAR YellowRecords = FILTER ( CurrentOfficeCustTable, 'Table'[Product] = "Yellow" ) VAR LastYellowExpDate = MAXX ( YellowRecords, 'Table'[Expiry Date] ) RETURN 'Table'[Product] = "Red" && 'Table'[Order Date] < LastYellowExpDate ), "Red Orders", 'Table'[Order ID] )
tamerj1
Community Champion
3 years agoHi Anonymous
Please refer to attached sample file with the solution
Table 2 =
SELECTCOLUMNS (
FILTER (
'Table',
VAR CurrentOfficeCustTable =
CALCULATETABLE ( 'Table', ALLEXCEPT ( 'Table', 'Table'[Office], 'Table'[Customer] ) )
VAR YellowRecords =
FILTER ( CurrentOfficeCustTable, 'Table'[Product] = "Yellow" )
VAR LastYellowExpDate =
MAXX ( YellowRecords, 'Table'[Expiry Date] )
RETURN
'Table'[Product] = "Red" && 'Table'[Order Date] < LastYellowExpDate
),
"Red Orders",
'Table'[Order ID]
)