Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Community,
I'm currently asking myself how I can merge two flag fields from my FACT Table?
Within my Script I create two separate flags depending on different conditions and stored both of them into my FACT table as FLAG1 and FLAG2. he value of the both flag fields is either 1 or it's empty. Now I want to merge both flags into one field.
The result should be also the value 1 or if the conditions is wrong it should stay empty.
I tried to solve this with the below formula. But the result duplicates the records within my fact table?
left join (FACTS) LOAD DISTINCT
if( (FLAG1 = 1 or FLAG2 = 1)
, 1) as FLAG
resident FACTS;
Has anyone an idea?
Many thanks in advance and best regards,
Claus
Instead of doing a left join.... just do this in your Fact Table
Fact:
LOAD ....,
FLAG1,
FLAG2,
If(FLAG1 = 1 or FLAG2 = 1, 1) as DOPPELBESUCH_FLAG
FROM ...;
Instead of doing a left join.... just do this in your Fact Table
Fact:
LOAD ....,
FLAG1,
FLAG2,
If(FLAG1 = 1 or FLAG2 = 1, 1) as DOPPELBESUCH_FLAG
FROM ...;
Many thanks Sunny!
That was the crucial hint. 🙂