Google-sheets – Left join 2 sheets on 2 key values, add constant value

formulasgoogle sheetsgoogle-sheets-arrayformulagoogle-sheets-queryvlookup

I'd like to join by date on these 2 sheets (Income & Expense), on key values month and day and add constant value from FixedCost sheet,

Income:
enter image description here

Expense:
enter image description here

Add FixedCost to every row/date:

enter image description here

Desired result, with subtotal on Dashboard sheet:
enter image description here

Example sheet:
https://docs.google.com/spreadsheets/d/1O1rZUstDNSXPdUVXvaDfPO4rAQs2cJWHimfGxbddtNU/edit#gid=1037187610

How can this be done? I've seen the array formula solution, but it looks like an inner join instead of a left join here: LEFT JOIN two and more tables in Google Sheets

Best Answer

=ARRAYFORMULA({Income!A1:E1, Expense!C1:D1, "FixedCost", "SubTotal"; 
 INDIRECT("Income!A2:E"&COUNTA(Income!A2:A)+1),
 IFERROR(VLOOKUP(TRANSPOSE(QUERY(TRANSPOSE(INDIRECT("Income!A2:B"&
 COUNTA(Income!A2:A)+1)),,999^99)), 
 {TRANSPOSE(QUERY(TRANSPOSE(Expense!A2:B),,999^99)), Expense!C2:D}, {2, 3}, 0), 0),
 TRANSPOSE(SPLIT(REPT(FixedCost!A2&"♠", COUNTA(Income!A2:A)), "♠")),
 ARRAY_CONSTRAIN(Income!C2:C-IFERROR(VLOOKUP(TRANSPOSE(QUERY(TRANSPOSE(
 INDIRECT("Income!A2:B"&COUNTA(Income!A2:A)+1)),,999^99)), 
 {TRANSPOSE(QUERY(TRANSPOSE(Expense!A2:B),,999^99)), Expense!C2:D}, 2, 0), 0)-
 FixedCost!A2, COUNTA(Income!A2:A), 1)})

0