This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let vStartOf2ndPreviousQuarter = Date(Floor(QuarterStart(Today(), -2)), 'YYYY-MM-DD'); | |
let vStartOf2ndPreviousQuarterNum = Num(Date(Floor(QuarterStart(Today(), -2)), 'YYYY-MM-DD')); | |
let vStartOfPreviousQuarter = Date(Floor(QuarterStart(Today(), -1)), 'YYYY-MM-DD'); | |
let vStartOfPreviousQuarterNum = Num(Date(Floor(QuarterStart(Today(), -1)), 'YYYY-MM-DD')); | |
let vStartOfCurrentQuarter = Date(Floor(QuarterStart(Today())), 'YYYY-MM-DD'); | |
let vStartOfCurrentQuarterNum = Num(Date(Floor(QuarterStart(Today())), 'YYYY-MM-DD')); | |
let vStartOfPreviousMonth = Date(Floor(MonthStart(Today(), -1)), 'YYYY-MM-DD'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use in chart title/subtitle/footer for describing what data is shown in a chart, etc | |
='Chart contains data up until and including ' & Date(Max({1} Date), 'YYYY-MM-DD') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// List all QVDs that should be loaded | |
// In this example the QVDs have a filename format of YYYYMMDD.qvd | |
// | |
// The rationale for loading QVDs this way, rather than using something like | |
// load "/some/path/*.qvd" where date > SomeDate | |
// is that the latter will have to test the date field of all lines within all QVDs in that directory. | |
// That might take a long time (and it will become slower over time, if new QVDs are added every day), whereas the method | |
// used in the code below offers (very close to) constant loading time. | |
// | |
For each Filename in 'D:\path\to\qvds' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// General syntax for set analysis | |
{$<Product = Product + {OurProduct1} – {OurProduct2} >} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sum FieldName per the last available date we have data for, withinin the current selection | |
Sum( {$<DateNum={$(#=Max(DateNum))}>} FieldName) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load US high level regions (easter, southern, midwest etc) and divisions | |
// From https://en.wikipedia.org/wiki/List_of_regions_of_the_United_States | |
// Could also use https://www.npac.com/the-npac/about/npac-regions if more granularity is needed | |
US_States: | |
NoConcatenate Load | |
[State code], | |
[US census region], | |
[US census division] | |
Inline [ | |
State code,US census region,US census division |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The obvious way of finding the max/min value of a field might something like this: | |
// | |
// LOAD max(salesDate) Resident dataTable; | |
// | |
// However, if dataTable is very large (hundred of millions of lines or more, with many columns), the above will be | |
// very slow, as we will end up traversing that entire table. | |
// | |
// Instead, the fastest method of achieving the desired result is to load the FieldValue()s. | |
// We then only look at the values of the salesDate field itself, and not the entire dataTable table. | |
// Performance gains by many orders of magnitude can be gained by using this method. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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 - [email protected] | |
REM | |
REM Credit to: http://stackoverflow.com/a/8387078 | |
setlocal EnableDelayedExpansion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
General format: | |
curl -X POST --data-urlencode 'payload={"channel": "#sense-notification", "username": "webhookbot", "text": "This is posted to #sense-notification and comes from a bot named sensebot.", "icon_emoji": ":ghost:"}' https://hooks.slack.com/services/<....enter_your_key_here....> | |
Formatting: https://slack.zendesk.com/hc/en-us/articles/202288908-How-can-I-add-formatting-to-my-messages- | |
More formatting formatting: https://api.slack.com/docs/formatting | |
Slack API docs: https://api.slack.com/incoming-webhooks | |
Available emojis: http://www.emoji-cheat-sheet.com/ | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var qsocks = require('qsocks') | |
var serializeApp = require('serializeapp') | |
var fs = require('fs-extra') | |
var Promise = require('promise') | |
function create(docname) { | |
qsocks.Connect({appname: docname}) | |
.then(function(global) { | |
return global.openDoc(docname) | |
}) |
OlderNewer