Skip to content

Instantly share code, notes, and snippets.

View ralfbecher's full-sized avatar

Ralf Becher ralfbecher

View GitHub Profile
@ralfbecher
ralfbecher / QlikView_Expression_to_format_Numbers_with_Factor_Denote.qvw
Created December 11, 2013 10:14
QlikView Expression to format Numbers with Factor Denote (eg. 100M, 200k)
=If(Value > 1E6, Round(Value/1E6, 1) & 'M',
If(Value > 1E3, Round(Value/1E3, 1) & 'k',
Value))
@ralfbecher
ralfbecher / QlikView_Load_Inline_with_Data_containing_Square_Brackets.qvw
Last active December 31, 2015 00:29
QlikView Load Inline with Data containing Square Brackets
Load * Inline "
String
Abc
CDE
[c4]
";
@ralfbecher
ralfbecher / QlikView_solving_slow_QVD_Load.qvw
Created December 11, 2013 13:51
QlikView solving slow QVD Load (not qvd optimized) with Where condition. A Load DISTINCT from QVD can be optimized too and is really fast (example would work without distinct although). So, this two-step approach is 2x faster.. The idea is to push the Where condition into a exists scenario.
/* Slow Load, not qvd optimized:
Bookings:
LOAD * From Bookings.qvd (qvd)
Where ID>0; // ..or with other condition: Not IsNull(ID)
*/
// qvd optimized
ExistingID:
LOAD DISTINCT ID From Bookings.qvd (qvd);
@ralfbecher
ralfbecher / QlikView_Extension_determine_amount_of_Dimensions.js
Created January 4, 2016 18:30
QlikView Extension determine amount of Dimensions from first data row (if multiple)
// get amount of Dimensions
var nDimensions = this.Data.Rows[0].filter(function(col){return !(col.color == undefined);}).length;
@ralfbecher
ralfbecher / Qlik_Expression_Baskets_ordered_by_Frequency.qvs
Last active February 5, 2016 10:28
Qlik Expression Baskets ordered by Frequency
// Baskets order by Frequency:
Concat(DISTINCT Product, ',', -Aggr(NODISTINCT Count(Product), Product))
@ralfbecher
ralfbecher / QlikView_Row-based_Transparent_Colors.qvs
Created February 12, 2016 18:49
QlikView Row-based Transparent Colors
// can be used in scatter chart to have persistend color for dimensions and nice opacity for overlapping bubbles:
=argb(180,
subfield(textbetween(color(RowNo()),'(',')'),',',1),
subfield(textbetween(color(RowNo()),'(',')'),',',2),
subfield(textbetween(color(RowNo()),'(',')'),',',3))
@ralfbecher
ralfbecher / QlikView_Scatter_Chart_determined_bubble_size.qvs
Last active February 12, 2016 21:11
QlikView Scatter Chart determined bubble size
// third expression:
dual( sum(Volume), sqrt( sum(Volume) ) )
// or
dual( sum(Betrag), pow( sum(Betrag), 0.7 ) )
define( ["require"], function ( localRequire ) {
var path = localRequire.toUrl( "extensions/d3-vis-library/d3-vis-library.css" );
});
(function() {
(function foo(node) {
if (node && node.$id) {
if (node.$$childHead) foo(node.$$childHead);
if (node.$$nextSibling) foo(node.$$nextSibling);
if (node.model && node.model.layout) node.model.layout.title = node.model.id;
}
})(qvangularGlobal.$rootScope);
$('*').css('-webkit-user-select', 'all');
pubsub.publish('/resize/end')
define(['d3'], function (d3) {
const ANIMATION_DURATION = 300;
var viz = {
x: d3.scale.ordinal(),
y: d3.scale.linear(),
xAxis: function () { return d3.svg.axis().scale(viz.x).orient('bottom') },
yAxis: function () { return d3.svg.axis().scale(viz.y).orient('left') }
};