I need please your help. See attached file, please.
INPUT are my data
FILTER (IN UI) are:
* FLAG (0 or 1)
* date reference FROM... TO...
* date cfr FROM... TO...
When I select FLAG = 1 just the store with FLAG = 1 in DATE REF FROM TO have to be considerd and with THOSE STORE I have to take revenue FROM DATE CFR TO DATE CFR (no matter if FLAG is 0 or 1 in those second dates).
In CFR I have to consider the same store as selected in REFERENCE and with the selected FLAG as if in CFR PERIOD FLAG would'nt exist.
Thank you in advance. In attach there are two examples to explain better .