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: 
merry2018
Creator III
Creator III

Mit SetExpression (SetAnalysis) festlegen das nur Werte genommen werden sollen, wenn Datum und Datum2 gleich sind

Hallo Zusammen,

ich suche eine Set Analysis Formel, welche mir nur die Werte summiert, die das selbe Datum in dem Datumsfeld 1 und zwei haben.

Um es besser zu verstehen was ich will, hier eine Beispieltabelle:

Sparte%KEY-ArtikelMenge Freitag %Key_Datum
TeilA470002.03.201801.03.2018
TeilA500002.03.201801.03.2018
TeilA500002.03.201802.03.2018
TeilA470009.03.201809.03.2018
TeilA500009.03.201810.03.2018
TeilB25009.03.201809.03.2018
TeilB25009.03.201810.03.2018
TeilB25009.03.201811.03.2018

Und zwar ist das Datum bei Freitag und %Key_Datum das selbe, also soll es mir folgendes anzeigen:

Teil495009.03.2018

Dieses habe ich mit folgenden Formeln versucht:

if(Floor(%Key_Datum)=Floor(Freitag),Menge,0)

SUM(aggr(<%Key_Datum_Kalender={'Freitag'}>sum(Rückstand.Menge),%Key_Datum_Kalender))

aber keine der beiden zeigt an was ich möchte. Die erste gibt es mir nur aus, wenn ich die betreffenden Artikel auswähle, und bei der zweiten stimmt vermutlich die Bedingung nicht ganz, denn diese gibt noch Garnichts aus.

Ich wäre sehr Dankbar über eine Hilfe von euch!

15 Replies
merry2018
Creator III
Creator III
Author

I tried that mapping, but it doesn't work, the script bring error and don't run till it is finish.

And that two formel don't work as well.

marcus_sommer

Please provide the relevant script-part.

- Marcus

merry2018
Creator III
Creator III
Author

That will not run:

map:
Mapping LOAD
%Key_Datum,
Freitag

Resident Kalender;

Rückstand:
lOAD *,
(ApplyMap('map',%Key_Datum, 0) = %Key_Datum) as Flag;

Load ...... From ...;

And if I Change the last Row to:

ApplyMap('map',%Key_Datum, 0)  as Flag;

it's not working as well.

merry2018
Creator III
Creator III
Author

I can not try that, because the mapping with the field 'Freitag' don't work, how you see in the answer further up.

Thank you for the explain for only.

marcus_sommer

It just means that the %Key_Datum from the Kalender isn't identically with them from your Rückstand table. This might happens because of different formattings or more likely different values, for example if one of %Key_Datum fields isn't a date else a timestamp - a formatting of a timestamp won't change the value of it else only something like:

date(floor(TimestampField))

would do it.

Of course you should take a look on them and adjust them appropriatly but I don't think you need this mapping for it when it comes from the Kalender - because you could create the flag just there with something like:

if(weekday(%Key_Datum)=4, 1, 0) as Flag

- Marcus

merry2018
Creator III
Creator III
Author

Leider kann ich kein weiteres Feld hinzufügen mit einem vorangestellten Load wie z. b.:

LOAD *,

  if(WeekDay((%Key_Datum)=4,1,0) as Flag;

Aber ich hab dieses jetzt vorerst mal in eine Listenbox eingefügt und schränke die werte dann so ein, bis ich eine Lösung habe.

Danke trotzdem mal für deine Hilfe bis hier hin.