Since you asked, I’ll go through the logic in case it helps someone else 
Here’s the processing for the first two generation (“prod”) inputs:
Basically just logging to a “phase” feed after setting any values under “5” to zero. I found that the Enphase system reports a few W of generation overnight and that didn’t sit well with me, so I filter it out.
Here’s the “main event” for production processing:
1 - 3 are with the same filtering above and logging to a “phase” feed.
4 - 6 add the other two generation feeds and then log that to a Total W feed
7 converts it to kWh and logs that to a generated energy feed
8 - 10 give me a “net power” value by removing the Generation from Consumption
11 checks if net power is positive (importing), and if so we jump to 13. Otherwise (row 12) we jump to 19
13 Logs to my “Import only” power feed - which is 0 if I’m exporting, and positive if I’m importing.
14 gives me an “Import energy” feed from 13
15 - 16 Sets the “Export only” power feed to 0 if I’m importing
17 does the same for my “Export only” energy feed - although looking at that now, I could just use log to feed as I’m converting 0W to 0kWh
18 Jumps to the end (skips over the “Export only” processing I’m about to go through)
19 - 24 are the exact reverse of the above 13 - 17, logging a “positive” value (as per row 19 “x -1”) of the power and energy to the “Export only” feeds and logging 0 to the “Import only” feeds when I’m exporting.
25 is basically a step so I have something to jump to from 18
What I end up with out of that is feeds for:
- Generated Power on phase A, B and C and Total
- Energy Generated
- Power Exported (always positive)
- Energy Exported (always positive)
- Power Imported (always positive)
- Energy Imported (always positive)
The consumption processing is a lot simpler as the “Import only” and "Export Only processing is done above. Some of the feeds below are used above as well. As for generation, I just log two of the phases to a “per phase” power feed, here’s the combined phases processing:
1-4 are just logging this phase to a feed and then adding the other two phases for total power and logging that as Consumed-W.
5 logs consumed energy
6-9 give me a “net power” value, positive while importing and negative while exporting (same as 8-10 in the generation processing, but I just log it “as-is” here)
10 gives me the equivalent cumulative energy
What I end up with out of that is feeds for:
- Consumed Power on phase A, B and C and Total
- Energy Consumed
- Net Power (positive for import, negative for export)
- Net Energy (positive for import, negative for export)
Now that I’ve typed all of that out, I can see two places where I am doing redundant calculations, I guess that is the benefit of looking back at it a few years later!
The “Import only” and “Export only” power and energy feeds are used in my “home dashboard” in that post I linked to above, although it has been updated since then to include “total energy” for the day:
NOTE: It’s just gone 1am here, so there’s been no generation yet today!
From left to right, those kWh totals are total generation, total consumption, total import, and total export, all since midnight. I pull them directly from those feeds I generated above.
EDIT: I also get this sort of graph capability with those “Import Only” and “Export Only” feeds:
