Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Ariele
Contributor III
Contributor III

Expressão com IF

Bom dia alguém poderia me ajudar? Estou tentando fazer uma formula simples aqui, porém o resultado nao está saindo como deveria, não sei se é porque desta forma nao tem como fazer .. Gostaria de trazer a mensagem sim caso o cliente tenha feito um pedido com o representante no mes especificado e a mensagem nao caso nao tenha feito... Fiz a formula da seguinte forma: if(count(distinct %Código_Pedido) > 0 and [Mês_Pedido] = 02, 'SIM', 'NÃO')

Labels (5)
1 Solution

Accepted Solutions
Ariele
Contributor III
Contributor III
Author

Entendi porque não aparece, seria porque nos meses , 02,03,04 a representante 6399 não obteve venda, há alguma forma de fazer ela aparecer mesmo não tendo venda com a opção NÃO aparecendo pra ela?

 

Ariele_0-1654196118780.png

 

View solution in original post

5 Replies
hic
Former Employee
Former Employee

Do you use this formula as a Dimension or as a Measure?

If it is a Dimension, then you cannot use Count() without wrapping it in an Aggr(). So you need to have a structure like

=Aggr(if(count(distinct %Código_Pedido) > 0 and [Mês_Pedido] = 02, 'SIM', 'NÃO'),[Mês_Pedido])

If it is a Measure, the problem could be that you have a naked field reference [Mês_Pedido]. If there are several values of [Mês_Pedido], then this will evaluate to NULL. Try the fillowing instead:

if(count(distinct %Código_Pedido) > 0 and Min([Mês_Pedido]) = 02, 'SIM', 'NÃO')
or
if(count(distinct %Código_Pedido) > 0 and Max([Mês_Pedido]) = 02, 'SIM', 'NÃO')

vinieme12
Champion III
Champion III

I think this as measure

= if(count({<[Order_Month={'02'}]>}distinct %Order_Code) > 0 , 'YES', 'NO')

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Ariele
Contributor III
Contributor III
Author

Boa tarde!

Quando tentei fazer por dimensão ele duplica o representando 6610, sendo que o correto para ele seria aparecer somente o SIM:

Ariele_0-1654194585315.png

Já quando tento fazer por medida, aparecem dois traços ao invés do NÃO para o representante 6399 e SIM para o representante 6610.

Ariele_1-1654194807357.png

 

Ariele
Contributor III
Contributor III
Author

Colocando deste forma, apareceu tudo sim

 

Ariele_0-1654195116052.png

 

Ariele
Contributor III
Contributor III
Author

Entendi porque não aparece, seria porque nos meses , 02,03,04 a representante 6399 não obteve venda, há alguma forma de fazer ela aparecer mesmo não tendo venda com a opção NÃO aparecendo pra ela?

 

Ariele_0-1654196118780.png