Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
FelipeMartins346
Contributor
Contributor

Painel Analyser

Pessoal , boa tarde

No código abaixo, faço o consumo das horas logadas dos usuário, consigo puxar os tipos e  nomes dos usuários ativos, porém, o período do último login está vindo em branco


LIB CONNECT TO 'DEV:QLIK SENSE ESPACES LOGIN';
 
RestConnectorMasterTable:
SQL SELECT 
"__KEY_root",
(SELECT 
"id",
"contentType",
"eventId",
"eventTime",
"eventType",
"eventTypeVersion",
"source" AS "source_u0",
"tenantId",
"userId",
"__KEY_data",
"__FK_data",
(SELECT 
"source",
"subject",
"__FK_data_u0"
FROM "data" FK "__FK_data_u0"),
(SELECT 
"__KEY_links",
"__FK_links",
(SELECT 
"Href",
"__FK_Self"
FROM "Self" FK "__FK_Self"),
(SELECT 
"href",
"__FK_self"
FROM "self" FK "__FK_self")
FROM "links" PK "__KEY_links" FK "__FK_links")
FROM "data" PK "__KEY_data" FK "__FK_data"),
(SELECT 
"Prev",
"__KEY_links_u0",
"__FK_links_u0",
(SELECT 
"Href" AS "Href_u0",
"__FK_Self_u0"
FROM "Self" FK "__FK_Self_u0"),
(SELECT 
"Href" AS "Href_u1",
"__FK_Next"
FROM "Next" FK "__FK_Next"),
(SELECT 
"href" AS "href_u0",
"__FK_self_u0"
FROM "self" FK "__FK_self_u0"),
(SELECT 
"href" AS "href_u1",
"__FK_next"
FROM "next" FK "__FK_next")
FROM "links" PK "__KEY_links_u0" FK "__FK_links_u0")
FROM JSON (wrap on) "root" PK "__KEY_root";
 
LEFT JOIN (USERS)
 
LOAD 
[userId] as ID_USER,
    MAX(timestamp(eventTime, 'DD/M/YYYY')) as LOGIN_DIA,
    Time(MAX(timestamp(eventTime-MakeTime(3)))) as LOGIN_HORA,
    IF(MAX((timestamp(eventTime))) >= TODAY()-45, '- 45 DIAS', '+ 45 DIAS') AS FLAG_LOGIN,
   Date#(tODAY(), 'DD/MM/YYYY') - Date#(MAX(timestamp(eventTime, 'DD/M/YYYY')) , 'DD/MM/YYYY') AS DIAS_ACESSO
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_data])
group by [userId];
 
DROP TABLE RestConnectorMasterTable;

 

Labels (4)
0 Replies