There have been a few examples recently where native Power BI line charts have had their value increased through the addition of variance intervals between two points.
Gustaw Dudek:
Chandeep Chhabra:
Here’s another take on such an augmented line chart showing the maximum and minimum of each selected date range using Deneb. All calculations are done in-visual in Deneb/Vega-Lite; no Power BI calculations (DAX) are used.
This example illustrates a number of Deneb/Vega-Lite features, including:
- • a “layer” of “layers” approach (single-mark line layer, 11-mark variance layer, and single-mark footnote layer)
- • a shared “params” block to set common values and to display radio buttons for period-of-interest selection
- • a shared “transform” block to extend the dataset through calculation of the maximum and minimum dates and close prices
- • a “filter” block inside the shared “transform” block to retain only the currently-selected date range
- • a shared “encoding” block to ensure all marks are aligned to the same X (date) values
- • Line layer:
- • uses the first colour in the current Power BI theme
- • displays approximately ten Y-axis ticks
- • Variance layer:
- • a “transform” block to extend the dataset through calculations of variance value, percent, direction, min and max labels, and variance note positioning
- • a “filter” block inside a “transform” block to retain only a single row (as, from the shared “transform” calculations, each row already contains all the values of interest)
- • 3 “rule” marks for the vertical and horizontal leader lines
- • 1 “rect” mark with border and fill to create a “white-space” for subsequent marks
- • 2 “circle” marks for the minimum and maximum values
- • 2 “text” marks for the multi-line minimum and maximum labels
- • 1 “point” mark for the variance indicator using calculated shapes and the positive and negative sentiment colours in the current Power BI theme
- • 2 “text” marks for the variance value and percent, again using the positive and negative sentiment colours in the current Power BI theme
- • Footnote layer:
- • uses dedicated text
- • uses the visual container size for positioning
The intent of this example is not to provide a finished visual, but rather to serve as a starting point for further custom visual development.
Also included is the sample PBIX using a 5-year NASDAQ composite index dataset as a demo.
This example is provided as-is for information purposes only, and its use is solely at the discretion of the end user; no responsibility is assumed by the author.
Greg
Deneb Examples - Line Chart with Min-Max Variance.pbix (1.5 MB)