You are on page 1of 2

Detail jumlah device per kategori pengguna tsel dan not_tsel

No Tsel Not_tsel Jml_device


1. 0 0 ?
2. 0 1 ?
3. 1 0 ?
4. 1 1 ?

No Step DOD kolom stg DOD QA


1 Create table tsel_stg1 Tsel int, - Tidak ada kolom cased dan
Not_tsel int, total_device yang null
Total_device int, - Catat jumlah keseluruhan
Cased int, device
From dq_bcp_dx_viz_tsel_stg3

**Total_device : Tsel + not_tsel


**Cased :
Tsel - not_tsel : cased
0–0:1
0–1:2
1–0:3
1–1:4
2 Create table tsel_stg2 Cased int, Total kategori tsel dan not tsel
Jum int, pada table tsel_stg1 harus sama
From tsel_stg1 dengan total kategori tsel dan
not_tsel pada table tsel_stg2
**jum : Count(cased)
**group by cased
**order by cased asc
STEP 1 : Create Table tsel_stg1
- Query
create table tsel_stg1 as
select tsel,
not_tsel,
(tsel + not_tsel) as total_device,
case when tsel = 0 and not_tsel = 0 then 1
when tsel =0 and not_tsel>=1 then 2
when tsel >= 1 and not_tsel = 0 then 3
else 4 end cased
from dq_bcp_dx_viz_tsel_stg3

- QA
desc Query Hasil
- Tidak ada kolom cased dan select total_device, Null
total_device yang null cased
from tsel_stg1
where total_device is
null and cased is null

- Catat jumlah keseluruhan select sum(total_device) 642,973


device from tsel_stg1;

STEP 2 : Create Table tsel_stg2


- Query
create table tsel_stg2 as
select cased,
sum(cased) as jml_device
from tsel_stg1
group by cased
order by cased;

- QA

desc Query Hasil


Total kategori tsel dan not tsel select sum(cased) from 492,525
pada table tsel_stg1 harus tsel_stg1
sama dengan total kategori select sum(jml_device) 492,525
tsel dan not_tsel pada table from tsel_stg2;
tsel_stg2

You might also like