A B C V
100 20 3000 32380
200 10 1000 22380
100 20 3000 12380
0 0 5000 42380
… … … …
When there is a data set like the one above, A: 500 B:90 C:10000 When a request value like this is received, the subsets that can be satisfied are found by adding the values of each row in that data set.
And then the V value is also A model that finds the combination in which the value of V becomes the lowest value.
so i want to know how to build model above?
Related
being new to qlikview Im a litle confused with I should do in sql and what qlik provides out of the box.
Lets suppose I have a table similar to this :
id Status type value quantity dat_s Area
1 Activo A 10 10 20171001 Norte
2 Activo B 20 20 20171001 Norte
3 Activo C 15 15 20171001 Sul
4 Fechado A 5 5 20171101 Norte
5 Activo B 20 20 20171101 Norte
6 Activo D 5 5 20171101 Sul
7 Activo D 5 5 20170901 Sul
Id like to compare a table with itself, but only the likes from selected dates, lets imagine, data A = 20171001 and date B= 20171001 (these should be user defined via an input field or whatever) the comparison id like to do is for example :
Type CountDateA ValDateA CountDateB ValDateB valuediff
A 1 100 1 25 -75
B 1 400 1 400 0
C 1 225 0 0 -225
D 0 0 1 25 25
or
Area ValDateA ValDateB valuediff
Norte 500 425 -75
Sul 225 25 -200
I was planing to duplicate the table and use different field names for the same data leaving half empty but I hope there is a more elegant way
Thanks all.
just needed to load the table and then the calculations of the clumns would be :
Sum(< Status ={$('Activo')}, dat ={$(20171001)} qty*val)
Still quite confused with your problem. Qlikview's power relies (in few words) on building graphs or tables that are automatically updated depending on selected filters. In your example, I guess, that filter would be the date (or dates) the user selects. Hence, you wouldn't need to define columns like ValDateA, ValDateB etc. In your case however, it seems that you want to compare EXACTLY two dates, so you could define those columns, each of them depending on different date pickers. This being said, I'll show you how I would approach your problem although I'm not really sure whether I understood well:
I assume you read your data correctly so you have the first data table on memory (with the fields: id Status type value quantity dat_s Area)(note: be careful and consistent with capital letters)
Create a table chart with dimension "type" (which will autofilter each row expression) and with these expressions:
Count(distinct{< Status = {"Activo"}, date_s= {"$(vDate1)"} >} id) //how many rows in active state for date1 (vDate1 is a variable assigned to the first date picker)
Sum({< Status = {"Activo"}, date_s= {"$(vDate1)"} >} value*quantity)
Same as expression 1 but using $(vDate2)
Same as expression 2 but using $(vDate2)
In Qlikview you can just write Column(4) - Column(2), in QlikSense you would need to write the whole expressions 2 and 4 again and subtract the sums.
I have got a table in ssrs 2008 like that:
Replacement
Location Date
Total Missing
X 100 20
Location Date
Total Missing
Y 200 50
Location Date
Total Missing
Z 300 80
I want to get rid of the repeats of titles but I could not manage it. I check Tablix properties and see "Repeat header..." and "Keep header..." options are all unchecked. Note that the table is grouped by Row:Location and Column:Date.
How can I remove repeated headers?
I want something like:
Replacement
Location Date
Total Missing
X 100 20
Y 200 50
Z 300 80
I appreciate for helps.
The group by Location appears to be on two rows of data, first row contains the title "Location" and the second row contains the expression =Location.
The group by Location needs to be on one row without the title in the grouping as denoted by the grouping handle.
I have a timestamp column which has following time entries...i m writing as alphabets for convenience.
Person Time
1 A
2 B
3 C
4 D
5 E
5 F
5 G
6 H
Now the objective is to group all the entries that have a time difference of less than 2 hours between them which are generated by the same person and the count of elements in that group.
And so if i had say 100 entries....first if i were to consider 10 out of 100 entries then i need to check whether all 10 entries are from the same person then check if first 10 had time difference of less than 2 hours between successive elements...if so then the count is 10....if the time difference between 10th and 11th was more...then 11th wont be counted....and if the successive elements were generated by different person...then they cannot be grouped for calculating count.
so principally its like grouping successive entries which fits this criteria and dividing the table into sets (not breaking the table just grouping) and find out which set has the max count for a person.....so if 86 to 100th entry fit the criteria...then the count is 15 provided 86 to 100 are all generated by same person and if every other set had less than 10...then the output of the query should be the person which provided this max time count
I have a table that for example it contain 1000 records. The query that I'm trying to do, is for get some like this:
substring_part_name number_of_warehose number_of_parts
156 1 50
156 2 140
156 3 300
180 3 130
120 1 80
120 2 300
And so obtain the 1000 records.
The trouble is this, the part_name is something like this: x_156, b_156, d_156, h_120, f_120 and so on. Every part has its corresponding warehouse.
The first column i get it on this way: distinct(substring(part_name,3)) as substring_part_name, I only want the last part of the name, How i can obtain that result??
My query is this:
select distinct(substring(part_name, 3)) as substring_part_name, count(#the number of parts by ware_house), ware_house from ware_houses
group by substring_part_name;
Use a negative integer for the SUBSTRING (-3) to get the last three characters.
select
distinct(substring(part_name, -3)) as substring_part_name,
number_of_warehouse,
number_of_parts
from table
You can also use RIGHT:
distinct(right(part_name, 3)) as substring_part_name
I would like help with sql query code to push the consequent data in a specific column down by a row.
For example in a random table like the following,
x column y column
6 6
9 4
89 30
34 15
the results should be "pushed" down a row, meaning
x column y column
6 null or 0 (preferably)
9 6
89 4
34 30
SQL tables have no inherent concept of ordering. Hence, the concept of "next row" does not make sense.
Your example has no column that specifies the order for the rows. There is no definition of next. So, what you want to do cannot be done.
I am not aware of a simple way to do this with the way you are showing the table being formatted. If your perhaps added two consecutively numbered integer fields that provide row number and row number + 1 values, you could join the table to itself and get that information.
After taking a backup of you table:
Make a PHP function that will:
- Load all values of Y into an array
- Set Y = 0 (MYSQL UPDATE)
- load the values back from PHP array to MYSQL