Skip to content

Instantly share code, notes, and snippets.

View ralfbecher's full-sized avatar

Ralf Becher ralfbecher

View GitHub Profile
@ralfbecher
ralfbecher / Qlik_Nice_Number_Format.qvs
Created December 14, 2016 14:17
Qlik Nice Number Format
//---------------------------------------------- Nice Numberformat simplified ---------------------------------------------
// does work with count in KPI object (have seen several versions from Qlik which haven't worked)
Set vF_NiceNumberSimple =
If(Fabs($1) > 1e9, Num($1/1e9+1e-13, '#$(ThousandSep)##0$(DecimalSep)00')
,If(Fabs($1) > 1e8, Num($1/1e6+1e-13, '##0$(DecimalSep)0')
,If(Fabs($1) > 1e6, Num($1/1e6+1e-13, '##0$(DecimalSep)00')
,If(Fabs($1) > 1e5, Num($1/1e3+1e-13,'##0$(DecimalSep)0')
,If(Fabs($1) > 1e3, Num($1/1e3+1e-13, '##0$(DecimalSep)00')
, $1,
))))) &
@ralfbecher
ralfbecher / wblGen.bat
Last active September 7, 2016 10:04 — forked from nate-untiedt/wblGen.bat
A simple batch file that automatically generates the wblfolder.wbl for your Qlik Sense visualization extension.
@echo off
REM wblGen.bat - v 1.0.0 - 2015-10-09
REM Description:
REM A simple batch file that automatically generates the wblfolder.wbl for your Qlik Sense visualization extension.
REM
REM Author: Nate Untiedt - Analytics8 - nuntiedt@analytics8.com
REM
REM Credit to: http://stackoverflow.com/a/8387078
setlocal EnableDelayedExpansion
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') }
};
@ralfbecher
ralfbecher / qlikNumberFromDate.js
Created May 16, 2016 15:47
JavaScript function to get QlikView or Qlik Sense numerical Date value from JavaScript Date
function qlikNumberFromDate(d) {
return d.getTime() / 86400000 + 25569;
}
(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( ["require"], function ( localRequire ) {
var path = localRequire.toUrl( "extensions/d3-vis-library/d3-vis-library.css" );
});
@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 ) )
@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 / 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_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;