Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
EMCK
Contributor
Contributor

Ignore selection in if statement

Hello Everyone,

this is my problem (maybe easy to solve, but I miss the right way):

I need to display a table with an all values of a defined Selection, but ignorering the current selection.

 

With set analysis it works perfect:

count(distinct{1<Year={"$(=max(Year))"},Articlsegment={'Schrauben'},PublishedYear={2019},,PublishedWeek={"$(=(Week-1))"}>}[ArticelNo]).

This works because expression and dimension are aggregation functions. In the table the dimension isn't an aggregation function, so set analysis doen' t work. The if statement looks like:

=if (
Articelsegment=('Schrauben') and PublishedWeek=(Week-1) and PublishedYear=(Year)
,NameArticel) . The problem is, that the if statement is influenced by the current selection.

 

The question is: Can I turn the if statement into a set analysis? Or how can I attach the if statement, to ignore the current selection?

 

 

Deutsch/German

Hallo zusammen,

 

ich habe folgendes Problem (wahrscheinlich leicht zu lösen, aber mir fehlt der richtige weg). Ich möchte in einem Dashboard eine Tabelle darstellen, die sämtliche Werte einer definierten Auswahl anzeigt, ohne jedoch die aktuelle Auswahl (current selection) mit einzubeziehen.

Mit der set analysis habe ich dieses erfolgreich programmiert: 

count(distinct{1<Year={"$(=max(Year))"},Articlsegment={'Schrauben'},PublishedYear={2019},,PublishedWeek={"$(=(Week-1))"}>}[ArticelNo]).

Dies funktioniert, weil Expression eine Aggregierungsfunktion ist. Nun soll aber zusätzlich die Produktbezeichnung aufgenommen werden. Diese wird nicht aggregiert, so dass die Set Analysis nicht greift. Das verwendete if Statement liefert aber nicht alle Daten, weil das if Statement wiederum die Aktuelle Auswahl (die nicht leer sein darf) berücksichtigt.

=if (
Articelsegment=('Schrauben') and Veroeff_Ab_Artikel_Woche=(Week-1) and Veroeff_Ab_Artikel_Jahr=(Year)
,NameArticel)

 

Daher nun meine Frage: Wie bringe ich dem If Statement bei, die aktuelle Auswahl zuignorieren, oder wie verwandle ich das if Statement in eine Setanalysis um?

 

1 Solution

Accepted Solutions
Stoyan_Terziev
Partner - Creator III
Partner - Creator III

Hello EMCK,

 

The output of the if-statement below may be an array of values (few article names). That's why QV may not be visualizing it.

Could you please try this solution (I changed a bit your set expression to fit my data set):

=Concat(distinct{1<Articlsegment={'Schrauben'},PublishedYear={2019},PublishedWeek={"$(=(39-1))"}>} ArticleName, chr(10))

image.png

Here's the data I used for the mock-up:

Articles:
LOAD
ArticleName
, ArticleID
, Articlsegment
, Date(Date#([Published Date], 'DD/MM/YYYY')) as [Published Date]
, Week(Date(Date#([Published Date], 'DD/MM/YYYY'))) as Week
;
LOAD * INLINE [
ArticleName, ArticleID, Published Date,Articlsegment
Article About Screws, 1,21/09/2019,Schrauben
Article About Screwdrivers, 2, 21/09/2019,Schrauben
];

image.png

 

I hope that helps!

 

Kind regards,

S.T.

View solution in original post

5 Replies
sunny_talwar

The if statement is used as an expression or dimension?

Stoyan_Terziev
Partner - Creator III
Partner - Creator III

Hello EMCK,

 

The output of the if-statement below may be an array of values (few article names). That's why QV may not be visualizing it.

Could you please try this solution (I changed a bit your set expression to fit my data set):

=Concat(distinct{1<Articlsegment={'Schrauben'},PublishedYear={2019},PublishedWeek={"$(=(39-1))"}>} ArticleName, chr(10))

image.png

Here's the data I used for the mock-up:

Articles:
LOAD
ArticleName
, ArticleID
, Articlsegment
, Date(Date#([Published Date], 'DD/MM/YYYY')) as [Published Date]
, Week(Date(Date#([Published Date], 'DD/MM/YYYY'))) as Week
;
LOAD * INLINE [
ArticleName, ArticleID, Published Date,Articlsegment
Article About Screws, 1,21/09/2019,Schrauben
Article About Screwdrivers, 2, 21/09/2019,Schrauben
];

image.png

 

I hope that helps!

 

Kind regards,

S.T.

EMCK
Contributor
Contributor
Author

used in Both

sunny_talwar

Both? You use this same expression as expression in a measure and dimension? What is the use of doing that? I am confused.

EMCK
Contributor
Contributor
Author

Works perfect, Thanks!