Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
paolo_cordini
Partner - Creator
Partner - Creator

Apparent set analysis inconsistency

Hello

In my Datamodel there is a calendar, linked to the fact table, as usual…:

paolo_cordini_0-1716280209865.png

 

Now, the measure in the table below has a set analysis which selects the dates above April 20th

paolo_cordini_1-1716280209869.png

 

The field “DataMovSettimana” contains the week, it is calculated in the script as Week(DataMov).

As you can see, the current selection is DataMovSettimana=18.

Then, as expected, the result is the intersection of the set analysis and the current selections, thus showing only dates pertaining to week 18.

So, the result of the table below is the expected one.

 

 

 

 

Then, I remove the dimension “DataMovSettimana” from the table, without modifying anything in the selections, and the result is shown below:

paolo_cordini_2-1716280209871.png

 

As you can see, the measure total value is different as it apparently disregards the selection of the week. Moreover, the espression “week(DataMov)” is not calculated for the dates excluded in the set analysis.

 

Then, I remove one of the selections (not the week). Now the result is correct….

paolo_cordini_3-1716280209873.png

 

 

 

Moreover, how this can be explained?

paolo_cordini_4-1716280209876.png

 

 

In order to debug it, I made a copy of the date fields, both in the fact table and in the calendar table

paolo_cordini_5-1716280209876.png

 

 

paolo_cordini_6-1716280209877.png

 

This is the result. Does it make sense? Anyway, it is a workaround for me in order to get correct results.

paolo_cordini_7-1716280209879.png

I guess there is some datamodel issue but I am running out of ideas to throubleshoot it.

Any suggestion?

 

Labels (1)
1 Solution

Accepted Solutions
paolo_cordini
Partner - Creator
Partner - Creator
Author

Hello everybody 

I have news on this topic. This has been recognized as a defect by the support.

At the end I was quite sure about that, as there were no other explanation left.

Thank you again for your effort tryng to find an explanation, I lost a lot of time too as I couldn't believe it is a flaw in the engine.

Paolo

View solution in original post

20 Replies
Firefly_cam
Partner - Contributor III
Partner - Contributor III

Check the format of DataMov in m-movimie table.
Seems that the relation key is not equal and you're calculating 22-28/04 dates based on the values in m-movimie table which are not related to calendar values.
When you select smth in Calendar, it works fine as those rows which are not related are disregarded.

Also as a thought, you might need to enclose your date value into single quotes in this case >='20/04/2024'  

Regards, Roman
marcus_sommer

There is no reason to apply a formatting to DataMov without specifying a different format as the default one. Therefore I assume that the date isn't a date else a timestamp which remains a timestamp regardless how it's formatted - even by date(DataMov, 'YYYY') it would be a timestamp and not a year.

If my above assumption is right, you will need something like this:

date(floor(DataMov))

paolo_cordini
Partner - Creator
Partner - Creator
Author

I first thought the same thing, already tried date(floor()), same issue....

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

I will say your calendar does not link to all records in your fact table. For test you can create duplicate of DataMov field in fact table DataMov as DataMovFact and DataMov as DataMovCal and then put all 3 fields DataMov, DataMovFact and DataMovCal in single table as diemension. If you see any gaps that is your answer. 

Cheers

 

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
Firefly_cam
Partner - Contributor III
Partner - Contributor III

Not sure if it's a timestamp issue, he's made copies of fields and both copies are not working:
Screenshot 2024-05-21 at 16.37.34.png 

In case of a timestamp issue at least the last sum() with DataMov_movime={} would work as expected

Regards, Roman
marcus_sommer

Make sure that's identically applied in the facts as well as within the calendar.

A chart with expressions isn't very helpful to check the exists and data-quality and also the associations between them. Better will be to use a table-box and set there all relevant fields side by side - here the date-key + the fact/dimension-date + the week + the other object-dimension and the measure-field. I assume something will look odd and could be investigated in more depths.

paolo_cordini
Partner - Creator
Partner - Creator
Author

No, the two copies of the date fields are working. The '91.654'  value that you see is correct. The result is not the correct one if I use the key date field.

paolo_cordini
Partner - Creator
Partner - Creator
Author

Already done. Nothing odd, everything appears correct with no misalignments, no NULLs, no holes...

Firefly_cam
Partner - Contributor III
Partner - Contributor III

Ok, Let's start from the beginning. The issue below is because you're trying to get Week(Date) in measure without aggregation. Measures return Null() when the result is a range instead of value. You can try Only(Week(Date)).
Screenshot 2024-05-21 at 19.11.25.png

As for the second part about set analysis, I have one theory what is the issue and this not obvious.
Can you do a favour and get a table with 2 dimensions: DateMov and Num(DateMov)? I would imagine you'll have multiple values of Num(DateMov) for each DateMov

Regards, Roman