
Tmdl
- 49 installs
- 836 repo stars
- Updated July 29, 2026
- data-goblin/power-bi-agentic-development
Author and edit TMDL files directly for semantic models in PBIP projects and convert BIM models to TMDL.
About
Expert guidance for authoring and editing TMDL (Tabular Model Definition Language) files directly in PBIP projects and converting BIM to TMDL. A developer uses it as a last-resort path to add measures, columns, or descriptions when higher tools are unavailable.
- Edits TMDL syntax, formatString, and summarizeBy directly
- Converts BIM models to TMDL for PBIP projects
Tmdl by the numbers
- 49 all-time installs (skills.sh)
- Ranked #935 of 2,064 Data Science & ML skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/data-goblin/power-bi-agentic-development --skill tmdlAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 49 |
|---|---|
| repo stars | ★ 836 |
| Last updated | July 29, 2026 |
| Repository | data-goblin/power-bi-agentic-development ↗ |
What it does
Author and edit TMDL files directly for semantic models in PBIP projects and convert BIM models to TMDL.
Files
TMDL Authoring
Expert guidance for authoring and editing TMDL (Tabular Model Definition Language) files directly in PBIP projects.
This skill is a last resort. Direct TMDL file editing lacks the validation, atomicity, and DAX query capabilities of the Tabular Editor CLI, Power BI MCP server, or the connect-pbid skill (TOM via PowerShell). Use those tools when available. TMDL editing is appropriate when:>
- Working with PBIP files in a Git repo without Power BI Desktop open
- No Tabular Editor CLI or MCP server is installed
- Making quick text-level fixes (descriptions, format strings, display folders) where a full tool chain is overkill
>
Direct TMDL editing does not validate DAX syntax, check referential integrity, or verify that property values are valid. Errors will only surface when the model is next loaded in Power BI Desktop or deployed via XMLA. Use the `pbip-validator` agent to check TMDL files for syntax issues, indentation errors, and referential integrity before opening in PBI Desktop.
When to Use This Skill
Activate only when the Tabular Editor CLI, Power BI MCP server, or connect-pbid skill are not available, and tasks involve:
- Editing
.tmdlfiles directly (measures, columns, tables, relationships) - Adding or modifying measure definitions in TMDL
- Adding descriptions to columns, measures, or tables
- Fixing
summarizeByorformatStringvalues - Understanding TMDL syntax rules (indentation, quoting, property ordering)
- Writing multi-line DAX in TMDL format
- Understanding the difference between
///descriptions and//comments
Critical
- `///` (triple-slash) sets the `Description` property on the object that immediately follows it. A
///line must be immediately followed by a declaration (measure,column,table, etc.); never by a blank line or another///. Use//for regular comments. - Indentation is semantic. TMDL uses whitespace indentation where depth equals nesting level (TMDL spec — Indentation). PBIP files use a single tab per level because Power BI Desktop and the TOM
TmdlSerializerdefault toIndentationMode.Tabs. Spaces are also valid (IndentationMode.Spaces, default 4 per level), but be consistent within a file; mixed or incorrect indentation will break the model. Properties of a table are indented one level; properties of a column (which belongs to a table) are indented two levels. - Name quoting rules: Only quote names that contain spaces, special characters, or start with a digit. Simple names and underscore-prefixed names are unquoted. See the Name Quoting section for details.
- M expressions and tables share a namespace. A name declared by
expression <name>inexpressions.tmdland a name declared bytable <name>intables/*.tmdlcollide; Power BI Desktop fails the load with'duplicate member <name>'. Pick distinct names; the conventional fix is to suffix the M expression withQueryorSourceand have partitions reference it viasource = #"<Name> Query".validate_pbip.pyenforces this as an ERROR.
TMDL File Types
| File | Contents | Location |
|---|---|---|
model.tmdl | Model configuration, ref table entries, query groups, annotations | definition/ |
database.tmdl | Compatibility level, model ID | definition/ |
relationships.tmdl | All relationships between tables | definition/ |
expressions.tmdl | Shared M expressions and parameters | definition/ |
functions.tmdl | DAX user-defined functions (reusable parameterized DAX) | definition/ |
roles/<RoleName>.tmdl | One file per security role (RLS filters, role members, OLS) | definition/roles/ |
perspectives/<Name>.tmdl | One file per perspective (object membership) | definition/perspectives/ |
dataSources.tmdl | Legacy data source definitions (if present) | definition/ |
tables/<Name>.tmdl | Table definition with columns, measures, hierarchies, partitions | definition/tables/ |
cultures/<locale>.tmdl | Linguistic metadata and translations | definition/cultures/ |
Object Nesting Rules
Objects must be nested inside their correct parent. The validator enforces these rules:
| Object | Allowed Parent(s) |
|---|---|
column, measure, hierarchy, partition, calculationGroup | table |
level | hierarchy |
calculationItem | calculationGroup |
tablePermission | role |
columnPermission | tablePermission |
perspectiveTable | perspective |
perspectiveColumn, perspectiveMeasure, perspectiveHierarchy | perspectiveTable |
linguisticMetadata, translation | cultureInfo |
dataAccessOptions | model |
formatStringDefinition | measure, calculationItem |
detailRowsDefinition | measure, table |
alternateOf | column |
member | role |
annotation, extendedProperty | any object (including queryGroup, function, member) |
ref | model, table |
Root-level objects (indent 0 only): model, database, table, relationship, role, cultureInfo, perspective, dataSource, expression, queryGroup, function.
Syntax Rules
Indentation
TMDL uses whitespace indentation where depth equals nesting level. PBIP files use a single tab per level (the TOM TmdlSerializer default), so all examples below use tabs:
table Product // depth 0: top-level declaration
lineageTag: abc-123 // depth 1: table property
measure '# Products' = // depth 1: measure declaration
COUNTROWS ( // depth 3: DAX expression body (one deeper than properties)
VALUES ( Product[Name] ) // depth 3: continued
) // depth 3: continued
formatString: #,##0 // depth 2: measure property
displayFolder: Measures // depth 2: measure property
lineageTag: def-456 // depth 2: measure property
column 'Product Name' // depth 1: column declaration
dataType: string // depth 2: column property
lineageTag: ghi-789 // depth 2: column property
summarizeBy: none // depth 2: column property
sourceColumn: Product Name // depth 2: column property
annotation SummarizationSetBy = Automatic // depth 2: column annotationKey rules:
- Use tabs in PBIP files (Power BI Desktop's default); see the Critical section above for the spaces alternative
- Table-level objects (columns, measures, hierarchies, partitions) are at depth 1
- Properties of those objects are at depth 2
- Multi-line DAX expression bodies are always 2 levels deeper than the enclosing declaration (depth 3 for measures/columns inside a table; depth 2 for top-level functions; depth 4 for calculationItems)
- Annotations are at the same depth as properties of their parent object, separated by a blank line
Descriptions (///)
Triple-slash sets the Description property on the next declaration. This is native TMDL syntax (not a Tabular Editor extension); the TMDL spec treats /// as first-class description support.
/// Count of distinct products in the current filter context.
measure '# Products' =
COUNTROWS ( VALUES ( Product[Product Name] ) )
formatString: #,##0
lineageTag: abc-123Rules:
///must be immediately followed by a declaration on the next line- No blank line between
///and the declaration - Multiple
///lines concatenate into a single description ///applies to the nextmeasure,column,table,hierarchy, orlevel
Common mistake:
// WRONG: blank line between /// and declaration
/// This is a description.
measure 'My Measure' = 1
// WRONG: /// used as a separator comment
///
measure 'My Measure' = 1
// RIGHT: /// immediately before declaration
/// This is a description.
measure 'My Measure' = 1
// RIGHT: // used for regular comments
// This is just a comment, not a description.
measure 'My Measure' = 1Comments (//)
Double-slash is a regular comment with no semantic effect:
// This is a comment — it does not set any property
measure 'My Measure' = 1Property Ordering
Properties should follow a consistent order, though TMDL is not strict about it. The conventional order is:
For columns: dataType, isHidden, isKey, displayFolder, lineageTag, summarizeBy, isNameInferred, sourceColumn, sortByColumn, then annotations.
For measures: DAX expression (on the = line or multi-line), formatString or formatStringDefinition, displayFolder, lineageTag, then annotations.
Name Quoting
When to Quote
Use single quotes around names that contain any of these characters:
- Spaces:
'Product Name' - Dots:
'Sales.Amount' - Equals:
'Price = Target' - Colons:
'Date:Key' - Single quotes (escape by doubling):
'Customer''s Name' - Other special characters:
'Sales ($)','OTD % (Value)','1) Selected Metric' - Names starting with a digit:
'4) Selected Period'
When NOT to Quote
Do not quote names that are simple identifiers:
Product(simple word)_Measures(underscore prefix, no spaces)Date(simple word)CgMetricQuantity(PascalCase, no spaces)
Examples
table Product // unquoted: simple name
table _Measures // unquoted: underscore prefix
table 'Budget Rate' // quoted: contains space
table 'Invoice Document Type' // quoted: contains spaces
table '1) Selected Metric' // quoted: starts with digit
table 'On-Time Delivery' // quoted: contains spaceColumn Definitions
For complete column examples (basic, hidden, key, sortByColumn, description), see `references/tmdl-file-examples.md`. For full property reference, see `references/column-properties.md`.
Key column pattern:
column 'Product Name'
dataType: string
displayFolder: 1. Product Hierarchy
lineageTag: abc-123
summarizeBy: none
sourceColumn: Product Name
annotation SummarizationSetBy = AutomaticMeasure Definitions
Single-Line DAX
measure '# Products' = COUNTROWS ( VALUES ( Product[Product Name] ) )
formatString: #,##0
displayFolder: Measures
lineageTag: abc-123Multi-Line DAX
Two syntaxes for multi-line DAX:
1. Indented block (most common) -- expression body indented two levels deeper than the declaration:
2. Triple-backtick block -- DAX enclosed in ` ` ` fences, useful for expressions with complex indentation:
measure Percentage = ```
VAR _Total = CALCULATE( SUM ( 'Table'[Quantitative] ), REMOVEFILTERS ( ) )
RETURN
DIVIDE ( SUM ( 'Table'[Quantitative] ), _Total )formatString: 0.0%;-0.0%;0.0% lineageTag: abc-123
**Indented block syntax** (standard approach) -- indented two extra tabs from the measure's parent (table) level:
measure 'Actuals MTD' = CALCULATE ( [Actuals], CALCULATETABLE ( DATESMTD ( 'Date'[Date] ), 'Date'[IsDateInScope] ) ) formatString: #,##0 displayFolder: 2. MTD\Actuals lineageTag: abc-123
### Measure with Description
/// Number of workdays elapsed month-to-date, considering only dates in scope. measure '# Workdays MTD' = CALCULATE( MAX( 'Date'[Workdays MTD] ), 'Date'[IsDateInScope] = TRUE ) formatString: #,##0 displayFolder: 5. Weekday / Workday\Measures\# Workdays lineageTag: abc-123
### Measure with formatStringDefinition (Dynamic Format)
measure 'Sales Target MTD vs. Actuals (%)' = Comparison.RelativeToTarget ( [Actuals MTD], [Sales Target MTD] ) displayFolder: 2. MTD\Sales Target lineageTag: abc-123
formatStringDefinition = FormatString.Comparison.RelativeToTarget ( "SUFFIX", 1, "ARROWS", "", "" )
**Note:** `formatStringDefinition` replaces `formatString` when the format is computed dynamically via a DAX expression (often a calculation group format function).
## Other Object Types
For complete examples of calculated columns, roles (RLS/OLS), calculation groups, date table marking, hierarchies, partitions, relationships, shared expressions, and model configuration, see **`references/tmdl-file-examples.md`**.
## Common Data Quality Patterns
### summarizeBy Rules
| Column Type | Correct `summarizeBy` | Reason |
|-------------|----------------------|--------|
| Keys (surrogate/natural) | `none` | Keys are never aggregated |
| Attributes (names, codes, types) | `none` | Text attributes are never summed |
| Dates | `none` | Dates are never summed |
| Boolean flags | `none` | Flags are never summed |
| Additive numeric facts (amounts, quantities) | `sum` | Default aggregation is SUM |
| Non-additive numeric facts (rates, percentages) | `none` | Cannot be meaningfully summed |
**Common fix pattern** — changing `summarizeBy: sum` to `summarizeBy: none` for key columns:
// Before (wrong - key column should not sum) column 'Customer Key' dataType: int64 isHidden lineageTag: abc-123 summarizeBy: sum sourceColumn: Customer Key
// After (correct) column 'Customer Key' dataType: int64 isHidden lineageTag: abc-123 summarizeBy: none sourceColumn: Customer Key
### formatString Patterns
| Data Type | Pattern | Example |
|-----------|---------|---------|
| Integer | `#,##0` | 1,234 |
| Decimal (2 places) | `#,##0.00` | 1,234.56 |
| Percentage | `#,##0%` or `0.00%` | 85% or 85.00% |
| Currency | `$#,##0.00` | $1,234.56 |
| Date | `mm/dd/yyyy` or `dd/mm/yyyy` | 01/15/2024 |
### PBI_FormatHint Annotation
Power BI Desktop may add a `PBI_FormatHint` annotation alongside `formatString`:
column Amount dataType: decimal formatString: #,##0.00 lineageTag: abc-123 summarizeBy: sum sourceColumn: Amount
annotation SummarizationSetBy = Automatic
annotation PBI_FormatHint = {"isGeneralNumber":true}
**Do not fight this annotation.** Power BI tooling re-adds it automatically. When setting a `formatString`, leave any existing `PBI_FormatHint` in place. If Power BI re-adds a removed `PBI_FormatHint`, accept it.
## Quick Reference
### Property Cheat Sheet
For the complete property reference for every object type, see **`references/object-properties.md`**.
| Object | Property | Values | Notes |
|--------|----------|--------|-------|
| Column | `dataType` | `string`, `int64`, `double`, `decimal`, `dateTime`, `boolean`, `binary`, `unknown`, `variant`, `automatic` | Required for data columns |
| Column | `summarizeBy` | `default`, `none`, `sum`, `min`, `max`, `count`, `average`, `distinctCount` | Use `none` for keys/attributes |
| Column | `type` | `data`, `calculated`, `rowNumber`, `calculatedTableColumn` | Column type variant |
| Column | `isHidden` | (flag, no value) | Boolean flags: write the keyword alone on its own line |
| Column | `isKey` | (flag, no value) | Marks the column as the table's key |
| Column | `isNullable` | (flag, no value) | Column allows nulls |
| Column | `isUnique` | (flag, no value) | Column values are unique |
| Column | `isNameInferred` | (flag, no value) | Name inferred from source |
| Column | `isDefaultLabel` | (flag, no value) | Default label for the table |
| Column | `isDefaultImage` | (flag, no value) | Default image for the table |
| Column | `isDataTypeInferred` | (flag, no value) | Data type inferred from source |
| Column | `isAvailableInMdx` | (flag, no value) | Available in MDX queries |
| Column | `keepUniqueRows` | (flag, no value) | Keep unique rows |
| Column | `encodingHint` | `default`, `hash`, `value` | Storage encoding hint |
| Column | `alignment` | `default`, `left`, `right`, `center` | Column alignment |
| Column | `displayFolder` | folder path string | Use `\` for nesting: `1. Year\Quarter` |
| Column | `sourceColumn` | source column name | Must match the Power Query output column |
| Column | `sortByColumn` | column name reference | Column to sort by (e.g., month name sorted by month number) |
| Column | `expression` | DAX expression | For calculated columns |
| Measure | `formatString` | format pattern | e.g., `#,##0`, `0.00%` |
| Measure | `displayFolder` | folder path string | Use `\` for nesting |
| Measure | `formatStringDefinition` | DAX expression block | Dynamic format string (replaces `formatString`) |
| Measure | `isHidden` | (flag, no value) | Hide the measure |
| Measure | `isSimpleMeasure` | (flag, no value) | Simple implicit-style measure |
| Measure | `dataCategory` | string | Semantic data category |
| Partition | `mode` | `import`, `directQuery`, `default`, `push`, `dual`, `directLake` | Storage mode |
| Partition | `sourceType` | `query`, `calculated`, `none`, `m`, `entity`, `policyRange`, `calculationGroup`, `inferred` | Source type |
| Relationship | `crossFilteringBehavior` | `oneDirection`, `bothDirections`, `automatic` | Cross-filter direction |
| Relationship | `securityFilteringBehavior` | `oneDirection`, `bothDirections`, `none` | RLS filter direction |
| Relationship | `fromCardinality` / `toCardinality` | `none`, `one`, `many` | Cardinality ends |
| Relationship | `isActive` | (flag, no value) | Active relationship |
| Role | `modelPermission` | `none`, `read`, `readRefresh`, `refresh`, `administrator` | Role permission level |
| Model | `discourageImplicitMeasures` | (flag, no value) | Disables implicit measures |
| Model | `defaultPowerBIDataSourceVersion` | `powerBI_V1`, `powerBI_V2`, `powerBI_V3` | PBI data source version |
| Model | `directLakeBehavior` | `automatic`, `directLakeOnly`, `directQueryOnly` | Direct Lake mode |
| All | `lineageTag` | GUID | Unique identifier, do not change existing values |
### Indentation Depth Summary
**Rule: a multi-line DAX body is always 2 levels deeper than its enclosing object declaration.**
| Context | Depth | Tabs |
|---------|-------|------|
| Top-level declaration (`table`, `relationship`, `expression`) | 0 | 0 |
| Table properties, column/measure/hierarchy declarations | 1 | 1 |
| Column/measure properties, hierarchy levels | 2 | 2 |
| DAX body for measure/column declared at depth 1 (inside table) | 3 | 3 |
| Level properties | 3 | 3 |
| DAX body for top-level `function` declared at depth 0 | 2 | 2 |
| `calculationItem` inside `calculationGroup` (depth 1) | 2 | 2 |
| DAX body for `calculationItem` at depth 2 | 4 | 4 |
## Additional Resources
### Reference Files
- **`references/object-properties.md`** - Complete property reference for all 30+ TMDL object types with valid enum values for every property type (dataType, summarizeBy, modeType, crossFilteringBehavior, etc.)
- **`references/column-properties.md`** - Column-specific property guide with `summarizeBy` rules, `formatString` patterns, `PBI_FormatHint` behavior
- **`references/naming-conventions.md`** - SQLBI naming conventions, display folder conventions, measure table conventions, and calculation group naming
- **`references/bim-to-tmdl.md`** - Converting between `model.bim` (TMSL) and `definition/` (TMDL) via Tabular Editor CLI or TOM TmdlSerializer
- **`references/tmdl-file-examples.md`** - Complete examples for every TMDL file type (model, database, expressions, relationships, roles, perspectives, tables, cultures) including backtick-enclosed expressions, field parameters, calculation groups, and date tables
### Fetching Docs
To retrieve current TMDL reference docs, use `microsoft_docs_search` + `microsoft_docs_fetch` (MCP) if available, otherwise `mslearn search` + `mslearn fetch` (CLI). Search based on the user's request and run multiple searches as needed to ensure sufficient context before proceeding.
### Example Model
- **`examples/SpaceParts.SemanticModel/`** -- Complete real-world TMDL model (SpaceParts) with 40 tables, 152 measures, 8 calculation groups, 8 RLS roles, 2 perspectives, DAX UDFs (functions.tmdl), shared M expressions, relationships, and cultures. Covers every TMDL file type. Key files to study:
- `definition/functions.tmdl` -- DAX user-defined functions with parameters, types, and multi-line expressions
- `definition/tables/Z04CG1 - Time Intelligence.tmdl` -- Calculation group with triple-backtick DAX
- `definition/tables/__Measures.tmdl` -- Measures table with calculation group references
- `definition/tables/Invoices.tmdl` -- Large fact table (51 measures, 18 columns)
- `definition/tables/Date.tmdl` -- Calculated date table with 42 columns
- `definition/roles/Account Managers.tmdl` -- RLS role with DAX filter expression
- `definition/relationships.tmdl` -- 27 relationships including inactive
- `definition/expressions.tmdl` -- Shared M/Power Query expressions and parameters
- `definition/perspectives/Measure Selection.tmdl` -- Perspective definition
### External References
- [TMDL overview (Microsoft Learn)](https://learn.microsoft.com/en-us/analysis-services/tmdl/tmdl-overview)
- [TMDL syntax reference (Microsoft Learn)](https://learn.microsoft.com/en-us/analysis-services/tmdl/tmdl-how-to)
- [SQLBI naming conventions](https://www.sqlbi.com/articles/rules-of-the-game-how-to-name-things-in-your-data-model/)
database SpaceParts
id: 8f2a2a29-0738-444a-8a5a-f83d26ec1f7f
compatibilityLevel: 1702
compatibilityMode: powerBI
language: 1033
expression SqlEndpoint = "te3-training-eu.database.windows.net" meta [IsParameterQuery=true, Type="Text", IsParameterQueryRequired=true]
lineageTag: c5701a1a-761b-4a4f-abb2-8bb5e7de8d4d
queryGroup: Parameters
annotation PBI_NavigationStepName = Navigation
annotation PBI_ResultType = Text
expression Database = "SpacePartsCoDW" meta [IsParameterQuery=true, Type="Text", IsParameterQueryRequired=true]
lineageTag: 423d49f9-2077-4e20-b035-c615e286df5e
queryGroup: Parameters
annotation PBI_NavigationStepName = Navigation
annotation PBI_ResultType = Text
expression RangeStart = #datetime(2023, 1, 1, 0, 0, 0) meta [IsParameterQuery=true, Type="DateTime", IsParameterQueryRequired=true]
lineageTag: f5c9c445-899a-4c4a-be86-ec32fc7dfe18
queryGroup: Parameters
annotation PBI_NavigationStepName = Navigation
annotation PBI_ResultType = DateTime
expression RangeEnd = #datetime(2023, 1, 31, 0, 0, 0) meta [IsParameterQuery=true, Type="DateTime", IsParameterQueryRequired=true]
lineageTag: eafae8e4-e0dd-4b47-8125-3149da661455
queryGroup: Parameters
annotation PBI_NavigationStepName = Navigation
annotation PBI_ResultType = DateTime
model SpaceParts
culture: en-US
defaultPowerBIDataSourceVersion: powerBI_V3
discourageImplicitMeasures
sourceQueryCulture: en-US
dataAccessOptions
legacyRedirects
returnErrorValuesAsNull
queryGroup Parameters
annotation PBI_QueryGroupOrder = 0
queryGroup 'Scalar Values'
annotation PBI_QueryGroupOrder = 1
queryGroup Tables
annotation PBI_QueryGroupOrder = 2
extendedProperty TabularEditor_DeploymentMetadata = {"User":"EXAMPLE\\user","Time":"2026-03-22T13:06:49.1493465+01:00","ClientMachine":"EXAMPLE","DeploymentMode":"SaveUI","TabularEditorBuild":"3.26.0.10695"}
annotation TabularEditor_SerializeOptions = {"IgnoreInferredObjects":true,"IgnoreInferredProperties":true,"IgnoreTimestamps":true,"SplitMultilineStrings":true,"PrefixFilenames":false,"LocalTranslations":true,"LocalPerspectives":true,"LocalRelationships":true,"Levels":["Data Sources","Shared Expressions","Perspectives","Relationships","Roles","Tables","Tables/Columns","Tables/Hierarchies","Tables/Measures","Tables/Partitions","Tables/CalculationItems","Translations"]}
annotation DataGoblins_SnekHighScore = 42
annotation __PBI_TimeIntelligenceEnabled = 0
annotation PBI_QueryOrder = ["Brands","Budget Rate","Customers","Employees","Exchange Rate","Invoice Document Type","Products","Regions","Budget","Invoices","Orders","Forecast","Order Document Type","Order Status","SqlEndpoint","Database","RangeStart","RangeEnd","Last Refresh"]
ref table Brands
ref table 'Budget Rate'
ref table Customers
ref table Employees
ref table 'Exchange Rate'
ref table 'Invoice Document Type'
ref table Products
ref table Regions
ref table Budget
ref table Invoices
ref table Date
ref table 'On-Time Delivery'
ref table Orders
ref table Forecast
ref table 'Order Document Type'
ref table 'Order Status'
ref table '1) Selected Metric'
ref table '2) Selected Unit'
ref table '3) Selected Target'
ref table '4) Selected Period'
ref table 'Z01CG1 - Quantity'
ref table 'Z01CG2 - Value (Budget Rate)'
ref table 'Z01CG4 - Lines'
ref table 'Z02CG1 - Unit'
ref table 'Z03CG1 - Sales Target'
ref table 'Z03CG2 - Orders Target'
ref table 'Z04CG1 - Time Intelligence'
ref table __Measures
ref table 'Last Refresh'
ref table zz_ReportObjects
ref table '__Demo UDFs'
ref table 'FP - MTD'
ref table 'Z04CG1 - Time Intelligence - UDFs'
ref table __SVGs
ref role 'Territory Managers'
ref role 'Account Managers'
ref role 'Brand VPs'
ref role 'Business Line Leaders'
ref role 'Station Sales Managers'
ref role 'System Regional Managers'
ref role 'System Sales Directors'
ref role 'Key Account Managers'
ref perspective 'No Measure Selection'
ref perspective 'Measure Selection'
ref cultureInfo en-US
perspective 'Measure Selection'
perspective 'No Measure Selection'
perspectiveTable Orders
perspectiveMeasure 'Total Net Order Quantity'
perspectiveMeasure 'Order Lines'
perspectiveMeasure 'Net Orders (Quantity)'
perspectiveMeasure 'Total Net Order Value'
perspectiveMeasure 'Net Orders'
perspectiveMeasure 'Net Orders 1YP'
perspectiveMeasure 'Net Orders 2YP'
perspectiveTable 'Order Status'
perspectiveColumn 'Order Status Group'
perspectiveColumn 'Order Status Text'
perspectiveTable 'Order Document Type'
perspectiveColumn Text
perspectiveColumn Group
perspectiveTable 'On-Time Delivery'
perspectiveMeasure 'OTD % (Lines)'
perspectiveMeasure 'OTD (Lines)'
perspectiveMeasure 'OTD (Quantity)'
perspectiveMeasure 'OTD % (Quantity)'
perspectiveMeasure 'OTD (Value)'
perspectiveMeasure 'OTD % (Value)'
relationship 0e6e4252-95c4-4e0e-a4c8-874e5463ec4c
fromColumn: Invoices.'Billing Date'
toColumn: Date.Date
relationship 7dacb5b5-3b77-45fe-85f9-cdebc76b1d56
fromColumn: Invoices.'Billing Document Type Code'
toColumn: 'Invoice Document Type'.'Billing Document Type Code'
relationship a9b264e6-c155-4643-adc9-e01ad2b308ea
fromColumn: Invoices.'Product Key'
toColumn: Products.'Product Key'
relationship 2fe91495-a480-42d8-bcf5-63ce2f84e4d0
fromColumn: Invoices.'Customer Key'
toColumn: Customers.'Customer Key'
relationship 03e537eb-3ddb-4c20-b5ad-9090c0aadd0d
fromColumn: Customers.Station
toColumn: Regions.Station
relationship aee91ed3-e637-4150-a8d4-22619ecc0034
fromColumn: Products.'Sub Brand Name'
toColumn: Brands.'Sub Brand'
relationship bbcee627-b8b2-4604-9ad8-9d2036321cfb
fromColumn: Budget.Month
toColumn: Date.Date
relationship 583c271a-a6ae-4f4b-bdb0-dfc91a31493e
fromColumn: Budget.'Customer Key'
toColumn: Customers.'Customer Key'
relationship b9c4b659-0116-4f12-af8c-704fe07f3112
fromColumn: Budget.'Product Key'
toColumn: Products.'Product Key'
relationship 4a26dc2c-f944-4c6e-9670-5e66e566c970
fromColumn: 'Exchange Rate'.Date
toColumn: Date.Date
relationship 7a4bdc99-ebb9-4dc1-92bd-c20e0460b638
fromColumn: Invoices.'Local Currency'
toColumn: 'Budget Rate'.'From Currency'
relationship 4eade231-e4d9-4b9f-8568-0f8dd9162e6f
fromColumn: Invoices.'OTD Indicator'
toColumn: 'On-Time Delivery'.'OTD Indicator'
relationship 1ae64f29-da13-4294-bde5-4320a84af2c1
fromColumn: Orders.'Order Date'
toColumn: Date.Date
/// Inactive relationship for analyzing orders by requested goods receipt date via USERELATIONSHIP
relationship 34c786fb-4d8e-41d3-a86c-fd83e71d8cc1
isActive: false
fromColumn: Orders.'Request Goods Receipt Date'
toColumn: Date.Date
relationship 6ef67eab-1e07-436d-a358-6197853f0064
fromColumn: Orders.'Sales Order Document Line Item Status'
toColumn: 'Order Status'.'Order Status Code'
relationship 5c8f76eb-7c06-4ed5-bdc2-6368b1f0ef0a
fromColumn: Orders.'Sales Order Document Type Code'
toColumn: 'Order Document Type'.'Sales Order Document Type Code'
relationship 7664202a-acbb-4942-a83e-60eb3b8537f9
fromColumn: Orders.'Product Key'
toColumn: Products.'Product Key'
relationship c97e9cf2-9441-4f5a-8609-f53e6a3a7571
fromColumn: Orders.'Customer Key'
toColumn: Customers.'Customer Key'
relationship 3795aac2-e6ba-48a7-9722-b7dd7af7b762
fromColumn: Forecast.'Forecast Month'
toColumn: Date.Date
relationship 599b10ac-8bcb-4550-b452-56d8954b2a35
toCardinality: many
fromColumn: Forecast.'Product Type'
toColumn: Products.Type
relationship 703b86a0-df9c-47d6-82e4-7c457de95971
toCardinality: many
fromColumn: Forecast.'Region Territory'
toColumn: Regions.Territory
relationship d3b21caa-eed5-4a2b-85a1-92a599807a8a
fromColumn: Orders.'Local Currency'
toColumn: 'Budget Rate'.'From Currency'
role 'Account Managers'
modelPermission: read
tablePermission Customers = RLS.ApplySimpleRLS ( 'Customers'[Account Manager] )
annotation PBI_Id = dbdfbff19eea4f0d84010925e3c7f23e
role 'Brand VPs'
modelPermission: read
tablePermission Brands = RLS.ApplySimpleRLS ( 'Brands'[Product Brand VP] )
annotation PBI_Id = 0b8d41815400413293ab3942e184b53e
role 'Business Line Leaders'
modelPermission: read
tablePermission Products = RLS.ApplySimpleRLS ( 'Products'[Product Business Line Leader] )
annotation PBI_Id = b975518cd80041dabbaf5d904a66b92f
role 'Key Account Managers'
modelPermission: read
tablePermission Customers = RLS.ApplySimpleRLS ( 'Customers'[Key Account Manager] )
annotation PBI_Id = 74b5a908a58f4954b252fd5d2c9cb895
role 'Station Sales Managers'
modelPermission: read
tablePermission Regions = RLS.ApplySimpleRLS ( 'Regions'[Station Sales Managers] )
annotation PBI_Id = fa0b2f174d25400296ad332b392a1c57
role 'System Regional Managers'
modelPermission: read
tablePermission Regions = RLS.ApplySimpleRLS ( 'Regions'[System Regional Managers] )
annotation PBI_Id = eaa78ebe59c245ccab75056fa76172e9
role 'System Sales Directors'
modelPermission: read
tablePermission Regions = RLS.ApplySimpleRLS ( 'Regions'[System Sales Directors] )
annotation PBI_Id = e1130bdac9114fbabf57e2875f59743b
role 'Territory Managers'
modelPermission: read
tablePermission Regions = RLS.ApplySimpleRLS ( 'Regions'[Territory Directors] )
annotation PBI_Id = 6d4eacc1cfdf475eb3dac207196ec47f
table '__Demo UDFs'
lineageTag: 8b3ecd6a-c429-4fb3-9bf5-414278e2a423
measure 'Actuals MTD - UDF' = TimeIntelligence.MonthToDate ( [Actuals] )
lineageTag: 2f77baba-a836-4da2-be73-5c92b184d662
formatStringDefinition = ```
-- An extreme example of a complex, dynamic format string
-- Normally this code would be 100s of lines; it's ~12 now with functions.
-- Function for dynamic unit formatting
FormatString.DynamicUnits (
-- What we're formatting
SELECTEDMEASURE ( ),
-- Currency symbol, because we want dynamic currency conversion
FormatString.Component.GetCurrencySymbol ( 'Exchange Rate'[From Currency] ) ,
-- Currency symbol position
FormatString.Component.GetCurrencyPosition ( 'Exchange Rate'[From Currency] ),
-- Custom prefix (none)
"",
-- Custom suffix (another measure, formatted in-line)
" ("
& FORMAT (
[Sales Target MTD vs. Actuals (%)],
"0.0%"
)
& ") "
)
```
measure 'Sales Target MTD - UDF' = TimeIntelligence.MonthToDate ( [Sales Target] )
lineageTag: 90ea6d89-e0b7-4a99-95fd-2ebb764fd73f
formatStringDefinition = ```
-- A moderate example of a complex, dynamic format string
-- Normally this code would be 100s of lines; it's ~12 now with functions.
-- Function for dynamic unit formatting
FormatString.DynamicUnits (
-- What we're formatting
SELECTEDMEASURE ( ),
-- Currency symbol, because we want dynamic currency conversion
-- Uses simpler approach
SELECTEDVALUE ( 'Exchange Rate'[Currency Symbol] ) ,
-- Currency symbol position
-- Uses simpler approach
SELECTEDVALUE ( 'Exchange Rate'[Position] ),
-- Custom prefix (none)
"",
-- Custom suffix (none)
""
)
```
measure 'Sales Target vs. Actuals (%) - UDF' =
Comparison.RelativeToTarget(
[Actuals MTD],
[Sales Target MTD]
)
lineageTag: 46910497-66e4-4b62-987d-67f3e9d8c4be
formatStringDefinition =
FormatString.RelativeToTarget.Percents (
"SUFFIX", -- Position of the symbol
1, -- Number of decimal places
"ARROWS", -- Symbol type
"", -- Custom prefix
"" -- Custom suffix
)
measure 'Dynamic Pareto of Actuals by Station - UDF' =
BusCalcs.Pareto(
[Actuals],
'Regions'[Station]
)
formatString: #,##0.0000%
lineageTag: e5095d5a-7db0-4ad2-b845-423e1748b525
column Value
isHidden
lineageTag: c44ed97b-0b8c-475e-a3ac-2f3eaa17cd75
isNameInferred
sourceColumn: [Value]
partition '__Demo UDFs' = calculated
mode: import
source = { 1 }
annotation TabularEditor_TableGroup = 00. Measure Tables
/// Everything in this Table Requires Measure Selection
/// 1. Select a Metric
/// 2. Select a Unit
/// 3. Select a Target
/// 4. Select a Period
/// 5. Select a Currency (from 'Exchange Rate')
/// 6. Select a Year and/or Month from 'Date'
///
table __Measures
lineageTag: c1f26e78-ea20-4757-b4d4-89e2237d2584
measure Actuals =
CALCULATE (
[Blank],
TREATAS (
DISTINCT ('2) Selected Unit'[Select a Unit]),
'Z02CG1 - Unit'[Unit]
)
)
formatString: #,##0
displayFolder: 1. Total\Actuals
lineageTag: 0a6cef3d-e27e-4055-a718-50e2e16947d2
measure 'Actuals MTD' =
CALCULATE (
[Actuals],
CALCULATETABLE (
DATESMTD ('Date'[Date]),
'Date'[IsDateInScope]
)
)
formatString: #,##0
displayFolder: 2. MTD\Actuals
lineageTag: ea39866d-9863-418f-884b-661ffb7be937
measure 'Actuals QTD' =
CALCULATE (
[Actuals],
CALCULATETABLE (
DATESQTD ('Date'[Date]),
'Date'[IsDateInScope]
)
)
formatString: #,##0
displayFolder: 3. QTD\Actuals
lineageTag: 75670b7b-105c-4bdd-83a1-1ead1595f242
measure 'Actuals YTD' =
CALCULATE (
[Actuals],
CALCULATETABLE (
DATESYTD ('Date'[Date]),
'Date'[IsDateInScope]
)
)
formatString: #,##0
displayFolder: 4. YTD
lineageTag: cceb1633-c625-4f81-92e9-220b5bcdf28f
measure Lines =
CALCULATE (
[Blank],
TREATAS (
DISTINCT ('1) Selected Metric'[Select a Measure]),
'Z01CG4 - Lines'[Measure]
)
)
formatString: #,##0
isHidden
displayFolder: 1. Total\Actuals
lineageTag: 70efca37-c432-410e-a447-3025e4237852
measure Quantity =
CALCULATE (
[Blank],
TREATAS (
DISTINCT ('1) Selected Metric'[Select a Measure]),
'Z01CG1 - Quantity'[Measure])
)
formatString: #,##0
isHidden
displayFolder: 1. Total\Actuals
lineageTag: c68488fd-5631-4b9f-a9c3-7f17d7f6a2ef
measure 'Sales Target YTD vs. Turnover (%)' =
VAR _TARGET = [Sales Target YTD]
VAR _DELTA = [Actuals YTD] - _TARGET
VAR _PERC = DIVIDE ( _DELTA, _TARGET )
RETURN
_PERC
formatString: #,##0.0% ↑;#,##0.0% ↓;#,##0.0%
displayFolder: 4. YTD
lineageTag: 0886ae94-a618-4cb5-a879-159717597f72
measure 'Sales Target YTD vs. Turnover (Δ)' =
[Actuals YTD] - [Sales Target YTD]
formatString: #,##0 ↑;#,##0 ↓;#,##0
displayFolder: 4. YTD
lineageTag: 60e7cc65-3801-4cf5-b186-7216e43c7086
measure Value = ```
CALCULATE (
[Blank],
TREATAS (
DISTINCT ('1) Selected Metric'[Select a Measure]),
'Z01CG2 - Value (Budget Rate)'[Measure]
)
)
```
formatString: #,##0
isHidden
displayFolder: 1. Total\Actuals
lineageTag: c5c7fd2d-5b7d-467c-953c-71338d4296f7
measure 'Sales Target YTD' =
VAR YRTD =
CALCULATE(
[Sales Target],
CALCULATETABLE(
DATESYTD( 'Date'[Date] ),
'Date'[IsDateInScope] = TRUE
),
'Date'[IsBeforeThisMonth] = TRUE
) // Calculates the target for the current month/year selection
VAR _CurrentMonth_value =
CALCULATE( [Sales Target], 'Date'[IsThisMonth] = TRUE ) // Calculates the % workdays MTD together with the dynamic parameter to set the exponential rate of increase MTD
VAR _currentMonthWorkDay =
POWER(
CALCULATE(
MAX( 'Date'[Workdays MTD %] ),
'Date'[IsDateInScope] = TRUE,
'Date'[IsThisMonth] = TRUE
),
0.93
) // If viewing units, hide the FCST (as there is no units FCST as of July 09, 2020)
VAR MOTD =
IF(
_CurrentMonth_value > 0,
_currentMonthWorkDay * _CurrentMonth_value,
BLANK( )
)
+ YRTD
VAR _PERIOD = SELECTEDVALUE( '4) Selected Period'[Period] )
VAR _YEAR = MAX( 'Date'[Calendar Year Number (ie 2021)] )
VAR _MONTH = MAX( 'Date'[Calendar Year Month (ie 202101)] )
RETURN
IF(
_PERIOD = "Full Period",
CALCULATE(
[Sales Target],
ALL( 'Date' ),
'Date'[Calendar Year Number (ie 2021)] = _YEAR,
'Date'[Calendar Year Month (ie 202101)] <= _MONTH
),
// If date is in the visual context and YTD is blank, show MTD, otherwise add YTD + MTD together
MOTD
)
formatString: #,##0
displayFolder: 4. YTD
lineageTag: 8baefb39-9d1b-40ad-9ad5-4f9c9c310095
measure 'Sales Target QTD' =
VAR _QTD =
CALCULATE(
[Sales Target],
CALCULATETABLE(
DATESQTD( 'Date'[Date] ),
'Date'[IsDateInScope] = TRUE
),
'Date'[IsThisMonth] = FALSE
)
VAR _MTD =
CALCULATE( [Sales Target MTD], 'Date'[IsThisMonth] = TRUE )
VAR _PERIOD = SELECTEDVALUE( '4) Selected Period'[Period] )
VAR _QUARTER = MAX( 'Date'[Calendar Year Quarter (ie 202101)] )
VAR _MONTH = MAX( 'Date'[Calendar Year Month (ie 202101)] )
RETURN
IF(
_PERIOD = "Full Period",
CALCULATE(
[Sales Target],
ALL( 'Date' ),
'Date'[Calendar Year Quarter (ie 202101)] = _QUARTER,
'Date'[Calendar Year Month (ie 202101)] <= _MONTH
),
IF(
ISBLANK( _QTD ),
_MTD,
// If date is in the visual context and QTD is blank, show MTD, otherwise add QTD + MTD together
IF( MAX ( 'Date'[Date] ) >= MAX ('Last Refresh'[Last Refresh]), _QTD + _MTD, _QTD )
)
)
formatString: #,##0
displayFolder: 3. QTD\Sales Target
lineageTag: 5e01dd13-583d-429c-9ba4-79b2fc89b918
measure 'Sales Target MTD' =
-- Calculates the target for the current month/year selection
VAR _CurrentMonth =
CALCULATE (
[Sales Target],
ALL ( 'Date' ),
VALUES (
'Date'[Calendar Month Year (ie Jan 21)]
)
)
-- Computes rate at which Budget increases through the month
VAR _CurrentMonthWDMTD =
POWER (
CALCULATE (
MAX ( 'Date'[Workdays MTD %] ),
'Date'[IsDateInScope] = TRUE
),
1.035
)
VAR CurrentMonthWDTotal =
POWER (
CALCULATE (
MAX ( 'Date'[Workdays MTD %] )
),
1.035
)
VAR _Period =
SELECTEDVALUE (
'4) Selected Period'[Period]
)
VAR _HasOneMonth =
HASONEVALUE (
'Date'[Calendar Month Year (ie Jan 21)]
)
RETURN
-- return MTD value if a month is selected
IF.EAGER (
_HasOneMonth && _Period = "Full Period",
CurrentMonthWDTotal
* _CurrentMonth,
IF (
_HasOneMonth,
_CurrentMonthWDMTD
* _CurrentMonth
)
)
formatString: #,##0
displayFolder: 2. MTD\Sales Target
lineageTag: 528d4072-5ea6-4427-97e0-7e812a0f511a
measure 'Sales Target' =
CALCULATE (
[Blank],
TREATAS (
DISTINCT (
'3) Selected Target'[Select a Target]
),
'Z03CG1 - Sales Target'[Target]
)
)
formatString: #,##0
displayFolder: 1. Total\Sales Target
lineageTag: 14bbba44-f1d9-49ad-ab20-4c7910d9d7da
measure 'Sales Target vs. Actuals (Δ)' =
[Actuals] - [Sales Target]
formatString: #,##0 ↑;#,##0 ↓;#,##0
displayFolder: 1. Total\Sales Target
lineageTag: 79869441-9511-4efb-b95a-147eb3d14926
measure 'Sales Target vs. Actuals (%)' =
VAR _TARGET = [Sales Target]
VAR _ACTUAL = [Actuals]
VAR _DELTA = _ACTUAL - _TARGET
VAR _PERC = DIVIDE ( _DELTA, _TARGET )
RETURN
_PERC
formatString: #,##0.0% ↑;#,##0.0% ↓;#,##0.0%
displayFolder: 1. Total\Sales Target
lineageTag: 876d123c-de76-4a10-84e7-470eed31b8c8
measure 'Sales Target MTD vs. Actuals (Δ)' =
[Actuals MTD] - [Sales Target MTD]
formatString: #,##0 ↑;#,##0 ↓;#,##0
displayFolder: 2. MTD\Sales Target
lineageTag: 30488de0-5eac-468b-a3db-81eea38a2165
measure 'Sales Target MTD vs. Actuals (%)' =
VAR _TARGET = [Sales Target MTD]
VAR _ACTUAL = [Actuals MTD]
VAR _DELTA = _ACTUAL - _TARGET
VAR _PERC = DIVIDE ( _DELTA, _TARGET )
RETURN
_PERC
formatString: #,##0.0% ↑;#,##0.0% ↓;#,##0.0%
displayFolder: 2. MTD\Sales Target
lineageTag: 2d7fff67-3495-4143-b0e4-2322aca32642
measure 'Actuals MTD, Latest Data Point' =
-- Max workday in scope
VAR _MAXWD =
CALCULATE (
MAX ( 'Date'[Workdays MTD] ),
'Date'[IsDateInScope],
ALLEXCEPT ('Date', 'Date'[Calendar Month Year (ie Jan 21)])
)
-- Max date in scope
VAR _MAXDT =
CALCULATE ( MAX ('Date'[Date] ),
'Date'[IsDateInScope],
ALLEXCEPT ('Date', 'Date'[Calendar Month Year (ie Jan 21)]) )
RETURN
-- If the selected workday = the max workday in scope, return the value
-- Otherwise return blank (don't show the marker / value)
IF (
MAX ('Date'[Workdays MTD]) = _MAXWD
|| MAX ('Date'[Date]) = _MAXDT,
[Actuals MTD]
)
formatString: #,##0
isHidden
displayFolder: 9. Technical Measures
lineageTag: f526af90-be40-4e71-a8af-700e44503379
measure 'Actuals MTD, Data Label' =
-- Max workday in scope
VAR _MAXWD =
CALCULATE (
MAX ( 'Date'[Workdays MTD] ),
'Date'[IsDateInScope],
ALLEXCEPT ('Date', 'Date'[Calendar Month Year (ie Jan 21)] )
)
-- Max date in scope
VAR _MAXDT =
CALCULATE ( MAX ('Date'[Date] ),
'Date'[IsDateInScope],
ALLEXCEPT ('Date', 'Date'[Calendar Month Year (ie Jan 21)]) )
RETURN
-- If the selected workday = the max workday in scope, return the value
-- Otherwise return blank (don't show the marker / value)
IF (
MAX ('Date'[Workdays MTD]) = _MAXWD
|| MAX ('Date'[Date]) = _MAXDT,
"#6e8c95",
"#FFFFFF00"
)
formatString: #,##0
isHidden
displayFolder: 9. Technical Measures
lineageTag: a38853fe-b2da-469e-b410-756d6c44e88d
measure Blank =
BLANK ()
isHidden
displayFolder: 9. Technical Measures
lineageTag: 7bc7070b-80ae-431e-8600-63befaa1d5bf
measure 'Orders Target' =
CALCULATE (
[Blank],
TREATAS (
DISTINCT ( '3) Selected Target'[Select a Target] ), 'Z03CG2 - Orders Target'[Target] )
)
formatString: #,##0
displayFolder: 1. Total\Orders Target
lineageTag: 4eed64a0-d832-4f27-ae28-91d1dc31cb89
/// Net orders exclude cancellation document types
measure 'Orders Target vs. Net Orders (%)' =
VAR _TARGET = [Orders Target]
VAR _DELTA = [Net Orders] - _TARGET
VAR _PERC = DIVIDE ( _DELTA, _TARGET )
RETURN
_PERC
formatString: #,##0.0% ↑;#,##0.0% ↓;#,##0.0%
displayFolder: 1. Total\Orders Target
lineageTag: e6cda3c8-6f0c-4d5a-8685-d41623fb81d9
/// Net orders exclude cancellation document types
measure 'Orders Target vs. Net Orders (Δ)' =
[Net Orders] - [Orders Target]
formatString: #,##0 ↑;#,##0 ↓;#,##0
displayFolder: 1. Total\Orders Target
lineageTag: baee51d7-d773-4a52-9486-6aed36e264c0
measure 'Orders Target MTD' = ```
-- Calculates the target for the current month/year selection
VAR _CurrentMonth =
CALCULATE (
[Orders Target],
ALL ( 'Date' ),
VALUES (
'Date'[Calendar Month Year (ie Jan 21)]
)
)
-- Computes rate at which Budget increases through the month
VAR _CurrentMonthWDMTD =
POWER (
CALCULATE (
MAX ( 'Date'[Workdays MTD %] ),
'Date'[IsDateInScope] = TRUE
),
0.93
)
VAR _CurrentMonthWDTotal =
POWER (
CALCULATE (
MAX ( 'Date'[Workdays MTD %] )
),
0.93
)
VAR _Period =
SELECTEDVALUE (
'4) Selected Period'[Period]
)
VAR __HasOneMonth =
HASONEVALUE (
'Date'[Calendar Month Year (ie Jan 21)]
)
RETURN
-- return MTD value if a month is selected
IF.EAGER (
__HasOneMonth && _Period = "Full Period",
_CurrentMonthWDTotal
* _CurrentMonth,
IF (
__HasOneMonth,
_CurrentMonthWDMTD
* _CurrentMonth
)
)
```
formatString: #,##0
displayFolder: 2. MTD\Orders Target
lineageTag: 1d671a50-fac4-4d2b-a41d-3328c522dafa
measure 'Orders Target QTD' =
VAR _DATES_QTD =
CALCULATETABLE (
DATESQTD ('Date'[Date]),
'Date'[IsThisMonth] = FALSE
)
VAR _CURRENT_MONTH_Forecast = [Orders Target MTD]
VAR _QTD_Forecast_BEFORE_THIS_MONTH = CALCULATE ([Orders Target], _DATES_QTD)
VAR _RESULT = _CURRENT_MONTH_Forecast + _QTD_Forecast_BEFORE_THIS_MONTH
RETURN
_RESULT
formatString: #,##0
displayFolder: 3. QTD\Orders Target
lineageTag: 8592bd67-7145-4ca4-ba42-fa3e0defba2e
measure 'Orders Target YTD' =
VAR _CURRENT_MONTH_TARGET = [Orders Target MTD]
VAR _YTD_TARGET_BEFORE_THIS_MONTH =
CALCULATE (
[Orders Target],
CALCULATETABLE (
DATESYTD ('Date'[Date]),
'Date'[IsThisMonth] = FALSE,
'Date'[IsDateInScope] = TRUE
)
)
VAR _RESULT = _CURRENT_MONTH_TARGET + _YTD_TARGET_BEFORE_THIS_MONTH
RETURN
_RESULT
formatString: #,##0
displayFolder: 4. YTD
lineageTag: 056c010c-5b3c-4faa-a65e-daeb3231600d
measure 'Turnover 2YP (Selected Unit)' =
CALCULATE ( [Turnover (Selected Unit)], DATEADD('Date'[Date], -2, YEAR ))
formatString: #,##0
isHidden
displayFolder: 1. Total\Sales Target
lineageTag: 7a676e6e-7385-4ce0-acb9-84a987fededa
measure 'Turnover 1YP (Selected Unit)' =
CALCULATE ( [Turnover (Selected Unit)], DATEADD('Date'[Date], -1, YEAR ))
formatString: #,##0
isHidden
displayFolder: 1. Total\Sales Target
lineageTag: 77b9b822-0dde-4ece-8dd7-3dd7a1a9bb14
column __Measures
isHidden
lineageTag: 721b2ff3-ac1f-41ae-b13b-e28a49828598
summarizeBy: sum
isNameInferred
sourceColumn: [__Measures]
annotation SummarizationSetBy = Automatic
partition __Measures = calculated
mode: import
source =
SELECTCOLUMNS (
{ 1 },
"__Measures", ''[Value]
)
annotation TabularEditor_TableGroup = 00. Measure Tables
table __SVGs
lineageTag: 90ee41a4-3e96-4f51-a532-29d55b1d3882
measure 'SVG Bullet Chart (with Action Dots) - UDF' =
-- Bullet Chart DAX SVG Visual
SVG.Chart.BulletChart.ActionDot (
[MTD Turnover], -- Actual
[MTD Turnover 1YP], -- Target
'Customers'[Key Account Name], -- Data scope
-0.050, -- Very bad threshold
-0.025, -- Bad threshold
0.025, -- Good threshold
0.050, -- Very good threshold
"#f4ae4c", -- Color for very bad
"#ffe075", -- Color for bad
"#74B2FF", -- Color for good
"#2D6390" -- Color for very good
)
displayFolder: Charts\Bullet Chart
lineageTag: 83aa4215-3dd8-4edd-ac50-4641e8a2ecbf
dataCategory: ImageUrl
annotation PBI_FormatHint = {"isGeneralNumber":true}
/// SVG Bullet Chart (with Action Dots) of MTD Turnover vs. MTD Turnover 1YP, grouped by Key Account Name
measure 'SVG Bullet Chart (with Action Dots)' = ```
-- Use this inside of a Table or a Matrix visual.
-- The 'Image size' property of the Table or Matrix should be set to a 'Height' of 25px and a 'Width' of 100px
----------------------------------------------------------------------------------------
-------------------- START CONFIG - SAFELY CHANGE STUFF IN THIS AREA -------------------
----------------------------------------------------------------------------------------
-- Input field config
VAR _Actual = [MTD Turnover]
VAR _Target = [MTD Turnover 1YP]
VAR _Performance = DIVIDE ( _Actual - _Target, _Target )
-- Sentiment config (percent)
VAR _VeryBad = -0.05
VAR _Bad = -0.025
VAR _Good = 0.025
VAR _VeryGood = 0.05
-- Chart Config
VAR _BarMax = 100
VAR _BarMin = 20
VAR _Scope = ALL ( 'Customers'[Key Account Name] )
-- Color config.
VAR _BackgroundColor = "#F5F5F5" -- Light grey
VAR _BarFillColor = "#CFCFCF" -- Medium grey
VAR _BaselineColor = "#737373" -- Dark grey
VAR _TargetColor = "black" -- Black
VAR _ActionDotFill =
SWITCH (
TRUE(),
_Performance < _VeryBad, "#f4ae4c", -- Dark yellow
_Performance < _Bad, "#ffe075", -- Light yellow
_Performance > _Good, "#74B2FF", -- Light blue
_Performance > _VeryGood, "#2D6390", -- Dark blue
"#FFFFFF00" -- Transparent
)
----------------------------------------------------------------------------------------
----------------------- END CONFIG - BEYOND HERE THERE BE DRAGONS ----------------------
----------------------------------------------------------------------------------------
-- Get axis maximum
VAR _MaxActualsInScope =
CALCULATE(
MAXX(
_Scope,
[MTD Turnover]
),
REMOVEFILTERS( 'Customers'[Key Account Name] )
)
VAR _MaxTargetInScope =
CALCULATE(
MAXX(
_Scope,
[MTD Turnover 1YP]
),
REMOVEFILTERS( 'Customers'[Key Account Name] )
)
VAR _AxisMax =
IF (
HASONEVALUE ( 'Customers'[Key Account Name] ),
MAX( _MaxActualsInScope, _MaxTargetInScope ),
CALCULATE( MAX( [MTD Turnover], [MTD Turnover 1YP] ), REMOVEFILTERS( 'Customers'[Key Account Name] ) )
) * 1.1
VAR _AxisRange =
_BarMax - _BarMin
-- Normalize values (to get position along X-axis)
VAR _ActualNormalized = ( DIVIDE ( _Actual, _AxisMax ) * _AxisRange )
VAR _TargetNormalized = ( DIVIDE ( _Target, _AxisMax ) * _AxisRange ) + _BarMin - 1
-- Vectors and SVG code
VAR _SvgPrefix = "data:image/svg+xml;utf8, <svg xmlns='http://www.w3.org/2000/svg'>"
VAR _Sort = "<desc>" & FORMAT ( _Actual, "000000000000" ) & "</desc>"
VAR _ActionDot = "<circle cx='10' cy='11' r='5' fill='" & _ActionDotFill &"'/>"
VAR _BarBaseline = "<rect x='" & _BarMin & "' y='4' width='1' height='60%' fill='" & _BaselineColor & "'/>"
VAR _BarBackground = "<rect x='" & _BarMin & "' y='2' width='" & _BarMax & "' height='80%' fill='" & _BackgroundColor & "'/>"
VAR _ActualBar = "<rect x='" & _BarMin & "' y='5' width='" & _ActualNormalized & "' height='50%' fill='" & _BarFillColor & "'/>"
VAR _TargetLine = "<rect x='" & _TargetNormalized & "' y='2' width='2' height='80%' fill='" & _TargetColor & "'/>"
VAR _SvgSuffix = "</svg>"
-- Final result
VAR _SVG =
_SvgPrefix
& _Sort
& _ActionDot
& _BarBackground
& _ActualBar
& _BarBaseline
& _TargetLine
& _SvgSuffix
RETURN
_SVG
```
isHidden
displayFolder: Charts\Bullet Chart
lineageTag: 9e670279-909d-4cb7-8944-ee5cae0ef3e8
dataCategory: ImageUrl
annotation PBI_FormatHint = {"isGeneralNumber":true}
measure 'SVG Overlapping Bars' =
// Sales Performance Overlapping Bars
SVG.Chart.BarChart.OverlappingBars(
[Actuals MTD], -- actual
[Budget MTD], -- target
'Customers'[Key Account Name], -- group_column
"#686868", -- color_actual (charcoal)
"#e1dfdd", -- color_target (grey)
"#fab005", -- color_variance_negative (yellow)
"#2094ff", -- color_variance_positive (blue)
"Segoe UI", -- font_family
10, -- font_size
600 -- font_weight
)
displayFolder: Charts\Bar Chart
lineageTag: c96c44ef-1829-4822-bc13-51a04fd79840
dataCategory: ImageUrl
measure 'SVG Overlapping Bars (No Label)' =
// Clean Overlapping Bars
SVG.Chart.BarChart.OverlappingBarsSimple(
[Actuals MTD], -- actual
[Budget MTD], -- target
'Customers'[Key Account Name], -- group_column
"#686868", -- color_actual (charcoal)
"#e1dfdd", -- color_target (grey)
"#fab005", -- color_variance_negative (yellow)
"#2094ff" -- color_variance_positive (blue)
)
displayFolder: Charts\Bar Chart
lineageTag: 585fd419-0c0c-4e5a-925b-226492bbca94
dataCategory: ImageUrl
measure 'Dumbbell Plot UDF' =
// Sales Dumbbell Chart
SVG.Chart.DumbbellPlot(
[Actuals MTD], -- actual
[Budget MTD], -- target
'Customers'[Key Account Name], -- column_one
"#448FD6", -- colour_on_target_fill (blue)
"#2F6698", -- colour_on_target_stroke (dark blue)
"#D64444", -- colour_off_target_fill (red)
"#982F2F" -- colour_off_target_stroke (dark red)
)
displayFolder: Charts\Dumbbell Chart
lineageTag: 4269644e-d142-41e3-817b-4f3430ff7461
dataCategory: ImageUrl
measure 'Waterfall UDF' =
SVG.Chart.Waterfall(
[Actuals MTD], -- actual
'Customers'[Key Account Name], -- column_one
"#dad9d8", -- colour_bar_category (light grey)
"#878582", -- colour_bar_total (dark grey)
"#333333" -- colour_connector (dark grey)
)
displayFolder: Charts\Waterfall Chart
lineageTag: 8f13880f-78c1-4997-9d36-d5aba33c3b6b
dataCategory: ImageUrl
/// SVG Overlapping Bar Chart (with Variance) of Actuals MTD vs. Budget MTD, grouped by Key Account Name
measure 'New SVG Overlapping Bar Chart (with Variance)' = ```
-- SVG measure
-- Use this inside of a Table or a Matrix visual.
-- The 'Image size' property of the Table or Matrix must match the values in the config below
----------------------------------------------------------------------------------------
-------------------- START CONFIG - SAFELY CHANGE STUFF IN THIS AREA -------------------
----------------------------------------------------------------------------------------
-- Input field config
VAR _Actual = [Actuals MTD]
VAR _Target = [Budget MTD]
VAR _Performance = DIVIDE ( _Actual - _Target, _Target )
-- Font config
VAR _Font = "Segoe UI"
VAR _FontSize = 10
VAR _FontWeight = 600
-- Chart Config
VAR _BarMax = 100
VAR _BarMin = 30
VAR _Scope = ALLSELECTED ( 'Customers'[Key Account Name] )
-- Color config.
VAR _ActualColor = "#686868" -- Charcoal
VAR _TargetColor = "#e1dfdd" -- Grey
VAR _VarianceColor =
IF (
_Performance < 0,
"#fab005", -- Yellow
"#2094ff" -- Blue
)
----------------------------------------------------------------------------------------
----------------------- END CONFIG - BEYOND HERE THERE BE DRAGONS ----------------------
----------------------------------------------------------------------------------------
VAR _MaxActualsInScope =
CALCULATE(
MAXX(
_Scope,
[Actuals MTD]
),
REMOVEFILTERS( 'Customers'[Key Account Name] )
)
VAR _MaxTargetInScope =
CALCULATE(
MAXX(
_Scope,
[Budget MTD]
),
REMOVEFILTERS( 'Customers'[Key Account Name] )
)
VAR _AxisMax =
IF (
HASONEVALUE ( 'Customers'[Key Account Name] ),
MAX( _MaxActualsInScope, _MaxTargetInScope ),
CALCULATE( MAX( [Actuals MTD], [Budget MTD] ), REMOVEFILTERS( 'Customers'[Key Account Name] ) )
) * 1.1
-- Normalize values (to get position along X-axis)
VAR _AxisRange =
_BarMax - _BarMin
VAR _ActualNormalized =
DIVIDE ( _Actual, _AxisMax ) * _AxisRange
VAR _TargetNormalized =
DIVIDE ( _Target, _AxisMax ) * _AxisRange
-- Vectors and SVG code
VAR _SvgPrefix = "data:image/svg+xml;utf8, <svg xmlns='http://www.w3.org/2000/svg'>"
VAR _Sort = "<desc>" & FORMAT ( _Actual, "000000000000" ) & "</desc>"
VAR _Icon = "<text x='" & _BarMin - 3 & "' y='13.5' font-family='Segoe UI' font-size='6' font-weight='700' text-anchor='end' fill='" & _VarianceColor & "'>" & FORMAT ( _Performance, "▲;▼;" ) & "</text>"
VAR _Label = "<text x='" & _BarMin - 10 & "' y='15' font-family='" & _Font & "' font-size='" & _FontSize & "' font-weight='" & _FontWeight & "' text-anchor='end' fill='" & _VarianceColor & "'>" & FORMAT ( _Performance, "#,##0%;#,##0%;#,##0%" ) & "</text>"
VAR _ActualBar = "<rect x='" & _BarMin & "' y='3' width='" & _ActualNormalized & "' height='12' stroke ='" & _ActualColor & "' fill='" & _ActualColor & "'/>"
VAR _TargetBar = "<rect x='" & _BarMin & "' y='10' width='" & _TargetNormalized & "' height='12' stroke='" & _ActualColor & "' fill='" & _TargetColor & "'/>"
VAR _VarianceBar = "<rect x='" & _BarMin + MIN( _ActualNormalized, _TargetNormalized ) + 1 & "' y='" & IF ( _Target > _Actual, 2.9, 9 ) & "' width='" & ABS( _ActualNormalized - _TargetNormalized ) - 1 & "' height='6' stroke='" & _VarianceColor & "' fill='" & _VarianceColor & "'/>"
VAR _SvgSuffix = "</svg>"
-- Final result
VAR _SVG =
_SvgPrefix
& _Sort
& _Icon
& _Label
& _TargetBar
& _ActualBar
& _VarianceBar
& _SvgSuffix
RETURN
_SVG
```
displayFolder: Charts\Bar Chart
lineageTag: d91b22ec-4852-48ad-8677-e4c60b372b92
dataCategory: ImageUrl
column Value
isHidden
lineageTag: a5b078c4-1ed5-4d7a-8e1b-1072c235c226
isNameInferred
sourceColumn: [Value]
partition __SVGs = calculated
mode: import
source = ```
{1}
// Test changewef ef
```
annotation TabularEditor_TableGroup = 00. Measure Tables
/// It lets you select a Metric.
table '1) Selected Metric'
lineageTag: 31535870-007d-4636-8348-2f06b750951d
measure DynamicTitle = ```
VAR _Metric = SELECTEDVALUE( '1) Selected Metric'[Select a Measure] )
VAR _Target = SELECTEDVALUE( '3) Selected Target'[Select a Target] )
VAR _Month = FORMAT( MAX( 'Date'[Date] ), "MMMM" )
VAR _Title =
_Metric & " vs. " & _Target & " for " & _Month
RETURN
_Title
```
lineageTag: 14be8612-d9ea-4236-bc61-37d220e83f28
annotation PBI_FormatHint = {"isText":true}
measure DynamicSubtitle =
"Showing the " & LOWER ( SELECTEDVALUE( '4) Selected Period'[Period] ) ) & ":"
lineageTag: 4d973a74-6257-45b9-8318-99129d82d632
annotation PBI_FormatHint = {"isGeneralNumber":true}
column Order
isHidden
lineageTag: 734455ee-3587-4f7b-bdd9-34f849747e7d
summarizeBy: sum
isNameInferred
sourceColumn: [Order]
annotation SummarizationSetBy = Automatic
column 'Select a Measure'
lineageTag: 16dc4342-12d1-4da6-89d8-63ba7be01ddf
summarizeBy: none
isNameInferred
sourceColumn: [Select a Measure]
sortByColumn: Order
annotation SummarizationSetBy = Automatic
partition '1) Selected Metric' = calculated
mode: import
source =
SELECTCOLUMNS(
'Z01CG2 - Value (Budget Rate)',
"Select a Measure", 'Z01CG2 - Value (Budget Rate)'[Measure],
"Order", 'Z01CG2 - Value (Budget Rate)'[Ordinal]
)
annotation TabularEditor_TableGroup = 04. Selection Tables
/// This is a disconnected table for Measure Selection.
/// It lets you select a Unit.
table '2) Selected Unit'
lineageTag: 8db601bc-67fe-4a66-8b3e-5751e675a807
column Order
isHidden
lineageTag: 6b618add-eff1-447d-b625-90bab65824d7
summarizeBy: sum
isNameInferred
sourceColumn: [Order]
annotation SummarizationSetBy = Automatic
column 'Select a Unit'
lineageTag: 01083816-a18e-4ea5-9fba-28c9b19b5f74
summarizeBy: none
isNameInferred
sourceColumn: [Select a Unit]
sortByColumn: Order
annotation SummarizationSetBy = Automatic
partition '2) Selected Unit' = calculated
mode: import
source = ```
SELECTCOLUMNS(
'Z02CG1 - Unit',
"Select a Unit", 'Z02CG1 - Unit'[Unit],
"Order", 'Z02CG1 - Unit'[Ordinal]
)
```
annotation TabularEditor_TableGroup = 04. Selection Tables
/// This is a disconnected table for Measure Selection.
/// It lets you select a Target.
table '3) Selected Target'
lineageTag: faedb0d7-81a5-4a5b-aa77-569ccb6f80d4
column 'MTD Slicer'
isHidden
lineageTag: 02184b60-9463-42cc-9353-3076dcfd57d1
summarizeBy: none
isNameInferred
sourceColumn: [MTD Slicer]
sortByColumn: Order
annotation SummarizationSetBy = Automatic
column Order
isHidden
lineageTag: 6549343f-cc13-417c-a7ec-4052e86c701d
summarizeBy: sum
isNameInferred
sourceColumn: [Order]
annotation SummarizationSetBy = Automatic
column 'Select a Target'
lineageTag: d66a7492-deb6-4fc5-8bf4-9ea15c424cfc
summarizeBy: none
isNameInferred
sourceColumn: [Select a Target]
sortByColumn: Order
annotation SummarizationSetBy = Automatic
partition '3) Selected Target' = calculated
mode: import
source =
SELECTCOLUMNS (
'Z03CG1 - Sales Target',
"Select a Target", 'Z03CG1 - Sales Target'[Target],
"Order", 'Z03CG1 - Sales Target'[Ordinal],
"MTD Slicer",
VAR _TARGET = 'Z03CG1 - Sales Target'[Target]
RETURN
SWITCH (
TRUE (),
_TARGET = "Budget", "Gross Sales MTD vs. Budget",
_TARGET = "Forecast", "Gross Sales MTD vs. FCST",
_TARGET = "1 Year Prior", "Gross Sales MTD vs. 1YP",
_TARGET = "2 Years Prior", "Gross Sales MTD vs. 2YP"
)
)
annotation TabularEditor_TableGroup = 04. Selection Tables
/// This is a disconnected table for Measure Selection.
/// It lets you select a Period
table '4) Selected Period'
lineageTag: d0747f9f-bab0-419e-87fb-7ae01f97a523
column MTD
isHidden
displayFolder: Columns\0. Select a Period
lineageTag: c9ee146b-ada4-4f64-b3ec-5367e8e35c2e
summarizeBy: none
isNameInferred
sourceColumn: [MTD]
sortByColumn: Order
annotation SummarizationSetBy = Automatic
column Order
isHidden
displayFolder: Columns\1. Order
lineageTag: 28ecb9f2-1504-4a33-9da4-5bcfcc9c3317
summarizeBy: sum
isNameInferred
sourceColumn: [Order]
annotation SummarizationSetBy = Automatic
column Period
lineageTag: 1f98320e-9b80-4c14-abbd-50b713f55446
summarizeBy: none
isNameInferred
sourceColumn: [Period]
sortByColumn: Order
annotation SummarizationSetBy = Automatic
column QTD
isHidden
displayFolder: Columns\0. Select a Period
lineageTag: 32c56d15-bb0d-4567-b661-75ae39b13044
summarizeBy: none
isNameInferred
sourceColumn: [QTD]
sortByColumn: Order
annotation SummarizationSetBy = Automatic
column YTD
isHidden
displayFolder: Columns\0. Select a Period
lineageTag: 25f552c2-f3ce-428e-a61c-dd66630c4bef
summarizeBy: none
isNameInferred
sourceColumn: [YTD]
sortByColumn: Order
annotation SummarizationSetBy = Automatic
partition '4) Selected Period' = calculated
mode: import
source = ```
UNION (
ROW (
"Period", {"Full Period"},
"Order", {0},
"MTD", {"Full Month"},
"QTD", {"Full Quarter"},
"YTD", {"Full Year"}
),
ROW (
"Period", {"Period-to-Date"},
"Order", {1},
"MTD", {"MTD"},
"QTD", {"QTD"},
"YTD", {"YTD"}
)
)
```
annotation TabularEditor_TableGroup = 04. Selection Tables
table Brands
lineageTag: 5e2b506f-5416-43b6-b5f6-160cbd60ab96
column Flagship
dataType: string
displayFolder: 1. Brand Hierarchy
lineageTag: 16be3840-ea52-4cb5-bbc1-f866be4193aa
summarizeBy: none
sourceColumn: Flagship
annotation SummarizationSetBy = Automatic
column Class
dataType: string
displayFolder: 1. Brand Hierarchy
lineageTag: e3b11f72-6c3d-4151-a219-5df0d87c75ab
summarizeBy: none
sourceColumn: Class
annotation SummarizationSetBy = Automatic
column Type
dataType: string
displayFolder: 2. Brand Attributes
lineageTag: f1c1b582-1730-4828-a57c-9e4148579d68
summarizeBy: none
sourceColumn: Type
annotation SummarizationSetBy = Automatic
column Brand
dataType: string
displayFolder: 1. Brand Hierarchy
lineageTag: 026cc844-0d0a-444c-b3e6-4755b618ee1c
summarizeBy: none
sourceColumn: Brand
annotation SummarizationSetBy = Automatic
column 'Sub Brand'
dataType: string
displayFolder: 1. Brand Hierarchy
lineageTag: 64d691d4-8f81-40ad-9626-f50a0fb25bfa
summarizeBy: none
sourceColumn: Sub Brand
annotation SummarizationSetBy = Automatic
column 'Product Brand VP'
dataType: string
displayFolder: 3. Managers
lineageTag: cd36ed0c-b7f0-404f-b8a0-ced180569814
summarizeBy: none
sourceColumn: Product Brand VP
annotation SummarizationSetBy = Automatic
hierarchy 'Brand Hierarchy'
displayFolder: 1. Brand Hierarchy
lineageTag: 084d70b4-6315-42f4-9fa3-84fac3f33e6b
level Class
lineageTag: 5457edb0-3439-4d56-baf9-e14078ae42d6
column: Class
level Flagship
lineageTag: 63f540d1-6f1a-4224-b13d-e5e8cf74727c
column: Flagship
level Brand
lineageTag: 47d9b70c-0dbe-4719-9c28-498808e9fe1b
column: Brand
level 'Sub Brand'
lineageTag: 4cf48791-4d41-4f0d-988b-385822b676aa
column: 'Sub Brand'
partition Brands = m
mode: import
queryGroup: Tables
source =
let
Source = Sql.Database(#"SqlEndpoint",#"Database"),
Data = Source{[Schema="Dimview",Item="Brands"]}[Data]
in
Data
annotation PBI_NavigationStepName = Navigation
annotation PBI_ResultType = Table
annotation TabularEditor_TableGroup = 01. Dimension Tables
table 'Budget Rate'
isHidden
lineageTag: 68dde8df-0ca5-4974-9afa-a3d1fc7dcf1f
column Rate
dataType: double
isHidden
displayFolder: 1. Facts
lineageTag: 46c64843-a8c8-49af-9770-8144db4c3640
summarizeBy: sum
sourceColumn: Rate
annotation SummarizationSetBy = Automatic
annotation PBI_FormatHint = {"isGeneralNumber":true}
column 'From Currency'
dataType: string
isHidden
displayFolder: 2. Keys
lineageTag: df013c22-0791-4223-9fe0-f45c70d95063
summarizeBy: none
sourceColumn: From Currency
annotation SummarizationSetBy = Automatic
column 'To Currency'
dataType: string
isHidden
displayFolder: 3. Other Currency Fields
lineageTag: d7d777a5-9b43-429b-a5eb-fb1ab1549af7
summarizeBy: none
sourceColumn: To Currency
annotation SummarizationSetBy = Automatic
column 'Currency System'
dataType: string
isHidden
displayFolder: 3. Other Currency Fields
lineageTag: f92a040a-f088-449b-8486-33aeeef0c9b2
summarizeBy: none
sourceColumn: Currency System
annotation SummarizationSetBy = Automatic
partition 'Budget Rate' = m
mode: import
queryGroup: Tables
source =
let
Source = Sql.Database(#"SqlEndpoint",#"Database"),
Data = Source{[Schema="Dimview",Item="Budget Rate"]}[Data]
in
Data
annotation PBI_NavigationStepName = Navigation
annotation PBI_ResultType = Table
annotation TabularEditor_TableGroup = 01. Dimension Tables
table Budget
lineageTag: a6b0eb60-264f-474d-a8fe-ac16f65fbc35
measure 'Budget MTD' = ```
-- Calculates the target for the current month/year selection
VAR _CURRENT_MONTH_VALUE =
CALCULATE (
[Budget],
ALL ( 'Date' ),
VALUES ( 'Date'[Calendar Month Year (ie Jan 21)] )
)
-- Computes rate at which Budget increases through the month
VAR _CURRENT_MONTH_PERC_WORKDAYS_MTD =
POWER (
CALCULATE (
MAX ( 'Date'[Workdays MTD %] ),
'Date'[IsDateInScope] = TRUE
),
1.035
)
VAR _CURRENT_MONTH_PERC_WORKDAYS =
POWER (
CALCULATE (
MAX ( 'Date'[Workdays MTD %] )
),
1.035
)
VAR _PERIOD =
SELECTEDVALUE (
'4) Selected Period'[Period]
)
VAR _HASONEMONTH =
HASONEVALUE (
'Date'[Calendar Month Year (ie Jan 21)]
)
RETURN
-- return MTD value if a month is selected
IF.EAGER (
_HASONEMONTH
&& _PERIOD = "Full Period",
_CURRENT_MONTH_PERC_WORKDAYS
* _CURRENT_MONTH_VALUE,
IF (
_HASONEMONTH,
_CURRENT_MONTH_PERC_WORKDAYS_MTD
* _CURRENT_MONTH_VALUE
)
)
```
formatString: #,##0
displayFolder: Measures\ii. MTD
lineageTag: e7c3e0f7-bc73-4250-93f4-17d3b3e06d2e
measure 'Budget MTD vs. Turnover (%)' =
VAR _TARGET = [Budget MTD]
VAR _DELTA = [MTD Turnover] - _TARGET
VAR _PERC = DIVIDE ( _DELTA, _TARGET )
RETURN
_PERC
formatString: #,##0.0% ↑;#,##0.0% ↓;#,##0.0%
displayFolder: Measures\ii. MTD
lineageTag: 8eb42713-706d-436a-a1c4-dda1c25494e1
measure 'Budget MTD vs. Turnover (Δ)' =
[MTD Turnover] - [Budget MTD]
formatString: #,##0 ↑;#,##0 ↓;#,##0
displayFolder: Measures\ii. MTD
lineageTag: dae40a70-a31d-41e3-bf4d-f77b08aefe31
measure 'Budget QTD' =
VAR _DATES_QTD =
CALCULATETABLE (
DATESQTD ('Date'[Date]),
'Date'[IsThisMonth] = FALSE
)
VAR _CURRENT_MONTH_Budget = [Budget MTD]
VAR QTD_BUDGET_BEFORE_THIS_MONTH = CALCULATE ([Budget], _DATES_QTD)
VAR _RESULT = _CURRENT_MONTH_Budget + QTD_BUDGET_BEFORE_THIS_MONTH
RETURN
_RESULT
formatString: #,##0
displayFolder: Measures\iii. QTD
lineageTag: 377282fa-8f79-4de5-b02c-9ed97ed804ff
measure 'Budget QTD vs. Turnover (%)' =
VAR _TARGET = [Budget QTD]
VAR _DELTA = [Turnover] - [Budget QTD]
VAR _PERC = DIVIDE ( _DELTA, _TARGET )
RETURN
_PERC
formatString: #,##0.0% ↑;#,##0.0% ↓;#,##0.0%
displayFolder: Measures\iii. QTD
lineageTag: 4b634367-f3b3-4b7e-a4c5-11ae1f0005a3
measure 'Budget QTD vs. Turnover (Δ)' =
[Turnover] - [Budget QTD]
formatString: #,##0 ↑;#,##0 ↓;#,##0
displayFolder: Measures\iii. QTD
lineageTag: 2a13f546-675f-46dc-80b9-e457b2aa9d01
measure 'Budget YTD' =
VAR _DATES_YTD =
CALCULATETABLE (
DATESYTD ( 'Date'[Date] ),
'Date'[IsThisMonth] = FALSE
)
VAR _CURRENT_MONTH_Budget = [Budget MTD]
VAR QTD_Budget_BEFORE_THIS_MONTH =
CALCULATE ( [Budget], _DATES_YTD )
VAR _RESULT =
_CURRENT_MONTH_Budget
+ QTD_Budget_BEFORE_THIS_MONTH
RETURN
_RESULT
formatString: #,##0
displayFolder: Measures\iv. YTD
lineageTag: 4cfd4bbc-3ee3-4224-8224-89ba77bfd212
measure 'Budget YTD vs. Turnover (%)' =
VAR _TARGET = [Budget YTD]
VAR _DELTA = [Turnover] - [Budget YTD]
VAR _PERC = DIVIDE ( _DELTA, _TARGET )
RETURN
_PERC
formatString: #,##0.0% ↑;#,##0.0% ↓;#,##0.0%
displayFolder: Measures\iv. YTD
lineageTag: 99f3b31f-c3eb-4f23-8403-959bdcf5cae0
measure 'Budget YTD vs. Turnover (Δ)' =
[Turnover] - [Budget YTD]
formatString: #,##0 ↑;#,##0 ↓;#,##0
displayFolder: Measures\iv. YTD
lineageTag: ee4a5a38-3679-4596-afa7-5f613a87ed87
measure 'Total Budget' = ```
VAR _SelectedRate = MAX ( 'Exchange Rate'[Rate] )
RETURN
SUM ( 'Budget'[Budget (EUR)] ) * _SelectedRate
```
formatString: #,##0
displayFolder: Measures\i. Total
lineageTag: 1cfbbd0e-ec57-4948-8e7c-e8a520d634c7
measure Budget = ```
IF.EAGER(
HASONEVALUE( '2) Selected Unit'[Select a Unit] )
&&
HASONEVALUE( 'Exchange Rate'[From Currency] ),
VAR _SELECTED_CURRENCY =
SELECTEDVALUE( 'Exchange Rate'[From Currency] )
VAR _SELECTED_RATE_TYPE =
SELECTEDVALUE( '2) Selected Unit'[Select a Unit] )
VAR _SELECTED_BUDGET_RATE =
MAX( 'Exchange Rate'[Rate] )
VAR _SELECTED_MONTHLY_RATE =
ADDCOLUMNS(
SUMMARIZE(
'Exchange Rate',
'Date'[Calendar Month Year (ie Jan 21)]
),
"Curr",
CALCULATE (
MAX( 'Exchange Rate'[Rate] )
)
)
RETURN
IF(
_SELECTED_RATE_TYPE = "Value (Budget Rate)",
SUM ( 'Budget'[Budget (EUR)])
*
_SELECTED_BUDGET_RATE,
IF(
_SELECTED_RATE_TYPE = "Value (Monthly Rate)",
SUMX(
_SELECTED_MONTHLY_RATE,
CALCULATE(
SUM ( 'Budget'[Budget (EUR)])
)
* [Curr]
)
)
)
)
```
formatString: #,##0
displayFolder: Measures\i. Total
lineageTag: 60d839fc-8ab6-4b78-af3f-80bc6305c529
measure 'Budget vs. Turnover (%)' =
VAR _TARGET = [Budget]
VAR _DELTA = [Turnover] - [Budget]
VAR _PERC = DIVIDE ( _DELTA, _TARGET )
RETURN
_PERC
formatString: #,##0.0% ↑;#,##0.0% ↓;#,##0.0%
displayFolder: Measures\i. Total
lineageTag: e5eb5098-0e4f-4d23-b7c5-bb287ff8bb59
measure 'Budget vs. Turnover (Δ)' =
[Turnover] - [Budget]
formatString: #,##0 ↑;#,##0 ↓;#,##0
displayFolder: Measures\i. Total
lineageTag: 824b1d58-869a-408c-a12e-ccdf950300ef
column Month
dataType: dateTime
isHidden
formatString: Long Date
displayFolder: 1. Keys
lineageTag: 23bef58e-18a2-4193-856d-2498101b880c
summarizeBy: none
sourceColumn: Month
annotation SummarizationSetBy = Automatic
annotation UnderlyingDateTimeDataType = Date
column 'Budget (EUR)'
dataType: double
isHidden
displayFolder: 2. Facts
lineageTag: 3f44e27b-e38e-489b-ab39-80615cb15782
summarizeBy: sum
sourceColumn: Budget (EUR)
annotation SummarizationSetBy = Automatic
column 'Customer Key'
dataType: string
isHidden
displayFolder: 1. Keys
lineageTag: f748b942-7ab6-4a6a-800e-7e1acfe97bca
summarizeBy: none
sourceColumn: Customer Key
annotation SummarizationSetBy = Automatic
column 'Product Key'
dataType: int64
isHidden
displayFolder: 1. Keys
lineageTag: f70c2f53-c04d-46a5-a162-d54d50bfffa0
summarizeBy: none
sourceColumn: Product Key
annotation SummarizationSetBy = Automatic
partition Budget = m
mode: import
queryGroup: Tables
source =
let
Source = Sql.Database(#"SqlEndpoint",#"Database"),
Data = Source{[Schema="Factview",Item="Budget"]}[Data],
#"Select Columns" = Table.SelectColumns ( Data, {"Customer Key", "Month", "Product Key", "Total Budget"} ),
#"Renamed Columns" = Table.RenameColumns(#"Select Columns",{{"Total Budget", "Budget (EUR)"}})
in
#"Renamed Columns"
annotation PBI_NavigationStepName = Navigation
annotation PBI_ResultType = Table
annotation TabularEditor_TableGroup = 02. Fact Tables
table Customers
lineageTag: c247ff24-c33b-4a9e-96f6-95d1e36e4be4
measure '# Customers' =
COUNTROWS (
VALUES ( 'Customers'[Customer Sold-To Name] )
)
formatString: #,##0
displayFolder: Measures
lineageTag: b99fd2f5-eff7-4fe3-8fee-b4f9e758f2bf
measure '# Key Accounts' =
COUNTROWS (
VALUES ( 'Customers'[Key Account Name] )
)
formatString: #,##0
displayFolder: Measures
lineageTag: 19c6259b-8906-4d55-9f07-f38335a43d03
column 'Customer Key'
dataType: string
isHidden
displayFolder: 4. Keys
lineageTag: 8138d992-9c95-4468-ad79-4607af12e82e
summarizeBy: none
sourceColumn: Customer Key
annotation SummarizationSetBy = Automatic
column 'Customer Sold-To Name'
dataType: string
displayFolder: 1. Customer Hierarchy
lineageTag: 57a55013-2487-4f85-9924-ba95d30adf0c
summarizeBy: none
sourceColumn: Customer Sold-To Name
annotation SummarizationSetBy = Automatic
column 'Account Name'
dataType: string
displayFolder: 1. Customer Hierarchy
lineageTag: a0b900e7-c1c7-4a87-aa1a-a52a61ece17d
summarizeBy: none
sourceColumn: Account Name
annotation SummarizationSetBy = Automatic
column 'Key Account Name'
dataType: string
displayFolder: 1. Customer Hierarchy
lineageTag: 449b79b3-9236-4e65-9f9e-2ac349ace7be
summarizeBy: none
sourceColumn: Key Account Name
annotation SummarizationSetBy = Automatic
column 'Transaction Type'
dataType: string
displayFolder: 2. Other Customer Attributes
lineageTag: d288644d-e68b-417a-b6ad-c229a86c5de4
summarizeBy: none
sourceColumn: Transaction Type
annotation SummarizationSetBy = Automatic
column 'Account Type'
dataType: string
displayFolder: 1. Customer Hierarchy
lineageTag: a0a0a72d-6c54-4e38-89c2-acf0084d375a
summarizeBy: none
sourceColumn: Account Type
annotation SummarizationSetBy = Automatic
column Station
dataType: string
isHidden
displayFolder: 4. Keys
lineageTag: 22b532a7-95c9-4055-98bd-f6c8624e21ea
summarizeBy: none
sourceColumn: Station
annotation SummarizationSetBy = Automatic
column 'Account Manager'
dataType: string
displayFolder: 3. Managers
lineageTag: 67fe957e-20ff-43ea-ae81-6e377ee37f71
summarizeBy: none
sourceColumn: Account Manager
annotation SummarizationSetBy = Automatic
column 'Key Account Manager'
dataType: string
displayFolder: 3. Managers
lineageTag: 72fc9786-6102-4514-a9f0-35cfc60809b4
summarizeBy: none
sourceColumn: Key Account Manager
annotation SummarizationSetBy = Automatic
hierarchy 'Customer Hierarchy'
displayFolder: 1. Customer Hierarchy
lineageTag: 21ce8263-4484-4671-9324-29eb1d5fb394
level 'Account Type'
lineageTag: 63750788-6ce3-468b-acfb-48561f995e59
column: 'Account Type'
level 'Key Account Name'
lineageTag: 695025d0-549e-4b7c-b020-926a32b43d89
column: 'Key Account Name'
level 'Account Name'
lineageTag: 4701a595-a719-4c4c-a262-0961ea84c24b
column: 'Account Name'
level 'Customer Sold-To Name'
lineageTag: 24730ed3-e089-46de-bd4c-26f648c4a791
column: 'Customer Sold-To Name'
partition Customers = m
mode: import
queryGroup: Tables
source = ```
let
// Data Source
Source = Sql.Database(
#"SqlEndpoint",
#"Database"
),
// Step
Data = Source
{
[
Schema = "Dimview",
Item = "Customers"
]
}
[Data]
// Result
in
Data
```
annotation PBI_NavigationStepName = Navigation
annotation PBI_ResultType = Table
annotation TabularEditor_TableGroup = 01. Dimension Tables
table Date
lineageTag: 0bb45e29-3908-422d-ade4-4100434bdfa4
dataCategory: Time
measure '# Workdays MTD' =
CALCULATE(
MAX( 'Date'[Workdays MTD] ),
'Date'[IsDateInScope] = TRUE
)
formatString: #,##0
displayFolder: 5. Weekday / Workday\Measures\# Workdays
lineageTag: 4b0555ab-6912-4d3c-b613-0d2d542a6965
measure '# Workdays QTD' =
CALCULATE(
MAX( 'Date'[Workdays QTD] ),
'Date'[IsDateInScope] = TRUE
)
formatString: #,##0
displayFolder: 5. Weekday / Workday\Measures\# Workdays
lineageTag: a07fb670-6765-4b8b-91da-3170765e8e94
measure '# Workdays YTD' =
CALCULATE(
MAX( 'Date'[Workdays YTD] ),
'Date'[IsDateInScope] = TRUE
)
formatString: #,##0
displayFolder: 5. Weekday / Workday\Measures\# Workdays
lineageTag: 0a27905d-9841-4cda-9976-ec65d16821d4
measure '# Workdays in Selected Month' =
IF (
HASONEVALUE ('Date'[Calendar Month Year (ie Jan 21)]),
CALCULATE (
MAX ('Date'[Workdays MTD]),
VALUES ('Date'[Calendar Month Year (ie Jan 21)])
)
)
formatString: #,##0
displayFolder: 5. Weekday / Workday\Measures\# Workdays
lineageTag: 55924c9b-cb78-47d3-824e-92cb1a525706
measure '# Workdays in Selected Quarter' =
IF (
HASONEVALUE ('Date'[Calendar Quarter Year (ie Q1 2021)]),
CALCULATE (
MAX ('Date'[Workdays QTD]),
VALUES ('Date'[Calendar Quarter Year (ie Q1 2021)])
)
)
formatString: #,##0
displayFolder: 5. Weekday / Workday\Measures\# Workdays
lineageTag: 84ccfbbd-bf7b-43b6-8e35-df7a54d0d9e7
measure '# Workdays in Selected Year' =
IF (
HASONEVALUE ('Date'[Calendar Year (ie 2021)]),
CALCULATE (
MAX ('Date'[Workdays YTD]),
VALUES ('Date'[Calendar Year (ie 2021)])
)
)
formatString: #,##0
displayFolder: 5. Weekday / Workday\Measures\# Workdays
lineageTag: a5eb1c3f-f13e-4d86-9fb2-d7bbb3fc3cf6
measure '% Workdays MTD' =
IF (
HASONEVALUE ('Date'[Calendar Month Year (ie Jan 21)]),
MROUND (
DIVIDE ([# Workdays MTD], [# Workdays in Selected Month]),
0.01
)
)
formatString: #,##0%
displayFolder: 5. Weekday / Workday\Measures\# Workdays
lineageTag: 68e3c8f6-6e44-4191-9e86-90afb7ddf261
measure '% Workdays QTD' =
IF (
HASONEVALUE ('Date'[Calendar Quarter Year (ie Q1 2021)]),
MROUND (
DIVIDE ([# Workdays QTD], [# Workdays in Selected Quarter]),
0.01
)
)
formatString: #,##0%
displayFolder: 5. Weekday / Workday\Measures\# Workdays
lineageTag: 7acd41b3-fc3c-4e8b-809c-a5edc09bc853
measure '% Workdays YTD' =
IF (
HASONEVALUE ('Date'[Calendar Year (ie 2021)]),
MROUND (
DIVIDE ([# Workdays YTD], [# Workdays in Selected Year]),
0.01
)
)
formatString: #,##0%
displayFolder: 5. Weekday / Workday\Measures\# Workdays
lineageTag: 74c83d7c-2d91-4dc3-87f3-d129a2b220ae
measure RefDate = CALCULATE ( MAX ( 'Invoices'[Billing Date] ), REMOVEFILTERS ( ) )
isHidden
displayFolder: Measures
lineageTag: 75027a89-68f7-4e3f-9d0b-abbb14b92094
column Date
isKey
displayFolder: 6. Calendar Date
lineageTag: 09572bf6-eb54-4fb5-8ad1-1dee0c198ec0
summarizeBy: none
isNameInferred
sourceColumn: [Date]
annotation SummarizationSetBy = Automatic
column 'Calendar Year Number (ie 2021)'
displayFolder: 1. Year
lineageTag: cf2e5156-c81b-4636-b66b-f9b439f92d2d
summarizeBy: sum
isNameInferred
sourceColumn: [Calendar Year Number (ie 2021)]
annotation SummarizationSetBy = Automatic
column 'Calendar Year (ie 2021)'
displayFolder: 1. Year
lineageTag: 3fb515aa-1cf5-4e35-9368-26ba9fe9609b
summarizeBy: none
isNameInferred
sourceColumn: [Calendar Year (ie 2021)]
sortByColumn: 'Calendar Year Number (ie 2021)'
annotation SummarizationSetBy = Automatic
column 'Calendar Quarter Year (ie Q1 2021)'
displayFolder: 2. Quarter
lineageTag: d8f8780d-8364-4be5-ad87-fb1d7e8bb57c
summarizeBy: none
isNameInferred
sourceColumn: [Calendar Quarter Year (ie Q1 2021)]
sortByColumn: 'Calendar Year Quarter (ie 202101)'
annotation SummarizationSetBy = Automatic
column 'Calendar Year Quarter (ie 202101)'
displayFolder: 2. Quarter
lineageTag: 6303b430-6995-46b7-82b1-4cd3102b9d6d
summarizeBy: sum
isNameInferred
sourceColumn: [Calendar Year Quarter (ie 202101)]
annotation SummarizationSetBy = Automatic
column 'Calendar Month Year (ie Jan 21)'
displayFolder: 3. Month
lineageTag: edb084ec-790c-4fee-a229-e24044d12bd4
summarizeBy: none
isNameInferred
sourceColumn: [Calendar Month Year (ie Jan 21)]
sortByColumn: 'Calendar Year Month (ie 202101)'
annotation SummarizationSetBy = Automatic
column 'Calendar Year Month (ie 202101)'
displayFolder: 3. Month
lineageTag: 2063cb48-7333-440e-acc1-5d12b4ef4641
summarizeBy: sum
isNameInferred
sourceColumn: [Calendar Year Month (ie 202101)]
annotation SummarizationSetBy = Automatic
column 'Calendar Month (ie Jan)'
displayFolder: 3. Month
lineageTag: 40d9d72e-8593-4b4b-a7bc-78a324b1decb
summarizeBy: none
isNameInferred
sourceColumn: [Calendar Month (ie Jan)]
sortByColumn: 'Calendar Month # (ie 1)'
annotation SummarizationSetBy = Automatic
column 'Calendar Month # (ie 1)'
displayFolder: 3. Month
lineageTag: e19f6bb4-ef58-4a9b-9938-a9f53054cfca
summarizeBy: sum
isNameInferred
sourceColumn: [Calendar Month # (ie 1)]
annotation SummarizationSetBy = Automatic
column 'Calendar Week EU (ie WK25)'
isHidden
displayFolder: 4. Week
lineageTag: da853b79-633f-4869-b291-880aa11452ad
summarizeBy: none
isNameInferred
sourceColumn: [Calendar Week EU (ie WK25)]
sortByColumn: 'Calendar Week Number EU (ie 25)'
annotation SummarizationSetBy = Automatic
column 'Calendar Week Number EU (ie 25)'
isHidden
displayFolder: 4. Week
lineageTag: 3eb012c2-1bb5-4cc3-bf3e-4d98a1fbfd27
summarizeBy: sum
isNameInferred
sourceColumn: [Calendar Week Number EU (ie 25)]
annotation SummarizationSetBy = Automatic
column 'Calendar Year Week Number EU (ie 202125)'
isHidden
displayFolder: 4. Week
lineageTag: 9239173d-70a1-4fb7-8ef8-b6b580e4c576
summarizeBy: sum
isNameInferred
sourceColumn: [Calendar Year Week Number EU (ie 202125)]
annotation SummarizationSetBy = Automatic
column 'Calendar Week US (ie WK25)'
isHidden
displayFolder: 4. Week
lineageTag: 54b2a8dd-1d3d-4350-8e50-ea3c2aa70603
summarizeBy: none
isNameInferred
sourceColumn: [Calendar Week US (ie WK25)]
sortByColumn: 'Calendar Week Number US (ie 25)'
annotation SummarizationSetBy = Automatic
column 'Calendar Week Number US (ie 25)'
isHidden
displayFolder: 4. Week
lineageTag: ee4f45a3-e866-4cd7-9a08-6b8b3e96cef4
summarizeBy: sum
isNameInferred
sourceColumn: [Calendar Week Number US (ie 25)]
annotation SummarizationSetBy = Automatic
column 'Calendar Year Week Number US (ie 202125)'
isHidden
displayFolder: 4. Week
lineageTag: 6369e90a-ee7b-4da8-9884-0457e4366927
summarizeBy: sum
isNameInferred
sourceColumn: [Calendar Year Week Number US (ie 202125)]
annotation SummarizationSetBy = Automatic
column 'Calendar Week ISO (ie WK25)'
isHidden
displayFolder: 4. Week
lineageTag: ef48982f-eb1c-4196-8059-9a69d4a1c7fe
summarizeBy: none
isNameInferred
sourceColumn: [Calendar Week ISO (ie WK25)]
sortByColumn: 'Calendar Week Number ISO (ie 25)'
annotation SummarizationSetBy = Automatic
column 'Calendar Week Number ISO (ie 25)'
isHidden
displayFolder: 4. Week
lineageTag: ae46b8f1-44d5-450d-b322-33f5ecb3a0dc
summarizeBy: sum
isNameInferred
sourceColumn: [Calendar Week Number ISO (ie 25)]
annotation SummarizationSetBy = Automatic
column 'Calendar Year Week Number ISO (ie 202125)'
isHidden
displayFolder: 4. Week
lineageTag: b7562b0b-32a5-49ab-8c2b-c0f933e8e272
summarizeBy: sum
isNameInferred
sourceColumn: [Calendar Year Week Number ISO (ie 202125)]
annotation SummarizationSetBy = Automatic
column 'Weekday Short (i.e. Mon)'
displayFolder: 5. Weekday / Workday\Weekday
lineageTag: 41ab7d65-b8a5-4011-9814-92b110086158
summarizeBy: none
isNameInferred
sourceColumn: [Weekday Short (i.e. Mon)]
sortByColumn: 'Weekday Number EU (i.e. 1)'
annotation SummarizationSetBy = Automatic
column 'Weekday Name (i.e. Monday)'
displayFolder: 5. Weekday / Workday\Weekday
lineageTag: ef85b198-9069-484e-b7d7-25425c242d1a
summarizeBy: none
isNameInferred
sourceColumn: [Weekday Name (i.e. Monday)]
sortByColumn: 'Weekday Number EU (i.e. 1)'
annotation SummarizationSetBy = Automatic
column 'Weekday Number EU (i.e. 1)'
displayFolder: 5. Weekday / Workday\Weekday
lineageTag: 6d6d80e2-e8a9-4d10-acff-4d7531522034
summarizeBy: sum
isNameInferred
sourceColumn: [Weekday Number EU (i.e. 1)]
annotation SummarizationSetBy = Automatic
column 'Calendar Month Day (i.e. Jan 05)'
displayFolder: 3. Month
lineageTag: 1b09698b-a90f-40ce-9596-6c6047ebe042
summarizeBy: none
isNameInferred
sourceColumn: [Calendar Month Day (i.e. Jan 05)]
sortByColumn: 'Calendar Month Day (i.e. 0105)'
annotation SummarizationSetBy = Automatic
column 'Calendar Month Day (i.e. 0105)'
displayFolder: 3. Month
lineageTag: 6e7c0f3a-b2bb-411a-a0a7-e267d7807ab4
summarizeBy: sum
isNameInferred
sourceColumn: [Calendar Month Day (i.e. 0105)]
annotation SummarizationSetBy = Automatic
column YYYYMMDD
isHidden
displayFolder: 6. Calendar Date
lineageTag: b8f541e5-acb5-4fdf-83b9-c031aee1e282
summarizeBy: sum
isNameInferred
sourceColumn: [YYYYMMDD]
annotation SummarizationSetBy = Automatic
column IsDateInScope
isHidden
displayFolder: 7. Boolean Fields
lineageTag: 4bca850c-4687-484d-a941-8b82c8ac9435
summarizeBy: none
isNameInferred
sourceColumn: [IsDateInScope]
annotation SummarizationSetBy = Automatic
column IsBeforeThisMonth
isHidden
displayFolder: 7. Boolean Fields
lineageTag: 3a3ebb62-fa77-42c9-94e7-7dd38cbcc9ca
summarizeBy: none
isNameInferred
sourceColumn: [IsBeforeThisMonth]
annotation SummarizationSetBy = Automatic
column IsLastMonth
isHidden
displayFolder: 7. Boolean Fields
lineageTag: 3cf4eb07-f6c1-4297-a58d-37d7bc7c0c5d
summarizeBy: none
isNameInferred
sourceColumn: [IsLastMonth]
annotation SummarizationSetBy = Automatic
column IsYTD
isHidden
displayFolder: 7. Boolean Fields
lineageTag: 1be5363a-e1d5-42c9-b335-83e6b593273c
summarizeBy: none
isNameInferred
sourceColumn: [IsYTD]
annotation SummarizationSetBy = Automatic
column IsActualToday
isHidden
displayFolder: 7. Boolean Fields
lineageTag: c158c062-5f41-4066-9b71-07040d22ea1c
summarizeBy: none
isNameInferred
sourceColumn: [IsActualToday]
annotation SummarizationSetBy = Automatic
column IsRefDate
isHidden
displayFolder: 7. Boolean Fields
lineageTag: a0711613-1ed5-4931-be77-c97fe1f71a3d
summarizeBy: none
isNameInferred
sourceColumn: [IsRefDate]
annotation SummarizationSetBy = Automatic
column IsHoliday
isHidden
displayFolder: 7. Boolean Fields
lineageTag: ee3e6d01-2621-4a08-b25a-591318b53703
summarizeBy: none
isNameInferred
sourceColumn: [IsHoliday]
annotation SummarizationSetBy = Automatic
column IsWeekday
isHidden
displayFolder: 7. Boolean Fields
lineageTag: bf956c16-2355-499b-b503-b88553b552df
summarizeBy: none
isNameInferred
sourceColumn: [IsWeekday]
annotation SummarizationSetBy = Automatic
column IsThisYear
isHidden
displayFolder: 7. Boolean Fields
lineageTag: 016d6200-8ae0-43de-85c0-fcf96e65fab3
summarizeBy: none
isNameInferred
sourceColumn: [IsThisYear]
annotation SummarizationSetBy = Automatic
column IsThisMonth
isHidden
displayFolder: 7. Boolean Fields
lineageTag: 51bcf435-6619-4d65-8dcf-b861329e2a51
summarizeBy: none
isNameInferred
sourceColumn: [IsThisMonth]
annotation SummarizationSetBy = Automatic
column IsThisQuarter
isHidden
displayFolder: 7. Boolean Fields
lineageTag: 3701707f-517d-4b04-a559-747ad90fa4ec
summarizeBy: none
isNameInferred
sourceColumn: [IsThisQuarter]
annotation SummarizationSetBy = Automatic
column IsThisWeek
isHidden
displayFolder: 7. Boolean Fields
lineageTag: 19c5b6d5-141d-4298-b0db-d60212c2707e
summarizeBy: none
isNameInferred
sourceColumn: [IsThisWeek]
annotation SummarizationSetBy = Automatic
column 'Workdays MTD' =
VAR _Holidays =
CALCULATETABLE (
DISTINCT ( 'Date'[Date] ),
'Date'[IsHoliday] <> TRUE
)
VAR _WeekdayName = CALCULATE ( SELECTEDVALUE ( 'Date'[Weekday Short (i.e. Mon)] ) )
VAR _WeekendDays = SWITCH (
_WeekdayName,
"Sat", 2,
"Sun", 3,
0
)
VAR _WorkdaysMTD =
CALCULATE (
NETWORKDAYS (
CALCULATE (
MIN ( 'Date'[Date] ),
ALLEXCEPT ( 'Date', 'Date'[Calendar Month Year (ie Jan 21)] )
),
CALCULATE ( MAX ( 'Date'[Date] ) - _WeekendDays ),
1,
_Holidays
)
)
+ 1
RETURN
IF ( _WorkdaysMTD < 1, 1, _WorkdaysMTD )
displayFolder: 5. Weekday / Workday\Workdays
lineageTag: f66ce538-103c-476a-b5b7-fdf95a7d756e
summarizeBy: sum
annotation SummarizationSetBy = Automatic
column 'Workdays QTD' =
VAR _Holidays =
CALCULATETABLE (
DISTINCT ('Date'[Date]),
'Date'[IsHoliday] <> TRUE
)
VAR _WeekdayName = CALCULATE ( SELECTEDVALUE ( 'Date'[Weekday Short (i.e. Mon)] ) )
VAR _WeekendDays = SWITCH (
_WeekdayName,
"Sat", 2,
"Sun", 3,
0
)
VAR _WorkdaysMTD =
CALCULATE (
NETWORKDAYS (
CALCULATE (
MIN ('Date'[Date]),
ALLEXCEPT ('Date', 'Date'[Calendar Quarter Year (ie Q1 2021)])
),
CALCULATE (MAX ('Date'[Date]) - _WeekendDays),
1,
_Holidays
)
)
+ 1
RETURN
IF (_WorkdaysMTD < 1, 1, _WorkdaysMTD)
displayFolder: 5. Weekday / Workday\Workdays
lineageTag: 9d01d75f-4942-4b6a-9217-a702574aaf64
summarizeBy: sum
annotation SummarizationSetBy = Automatic
column 'Workdays YTD' =
VAR _Holidays =
CALCULATETABLE (
DISTINCT ('Date'[Date]),
'Date'[IsHoliday] <> TRUE
)
VAR _WeekdayName = CALCULATE ( SELECTEDVALUE ( 'Date'[Weekday Short (i.e. Mon)] ) )
VAR _WeekendDays = SWITCH (
_WeekdayName,
"Sat", 2,
"Sun", 3,
0
)
VAR _WorkdaysMTD =
CALCULATE (
NETWORKDAYS (
CALCULATE (
MIN ('Date'[Date]),
ALLEXCEPT ('Date', 'Date'[Calendar Year (ie 2021)])
),
CALCULATE (MAX ('Date'[Date]) - _WeekendDays),
1,
_Holidays
)
)
+ 1
RETURN
IF (_WorkdaysMTD < 1, 1, _WorkdaysMTD)
displayFolder: 5. Weekday / Workday\Workdays
lineageTag: 439c9bb8-b5df-4014-92dd-384c1bcdaf5c
summarizeBy: sum
annotation SummarizationSetBy = Automatic
column 'Workdays MTD %' =
DIVIDE (
'Date'[Workdays MTD],
/* Number of weekdays MTD for selected month */
CALCULATE (
[# Workdays in Selected Month],
ALLEXCEPT ( 'Date', 'Date'[Calendar Month Year (ie Jan 21)] )
),
/* Total number of weekdays for selected month */
0
)
formatString: 0.00%
displayFolder: 5. Weekday / Workday\Workdays
lineageTag: cd816ac9-657f-4f27-ae68-ba35c84475f5
summarizeBy: sum
annotation SummarizationSetBy = Automatic
column 'Calendar Quarter (ie Q1)'
displayFolder: 2. Quarter
lineageTag: 0808e9ee-085c-4934-9b9d-c647eba54590
summarizeBy: none
isNameInferred
sourceColumn: [Calendar Quarter (ie Q1)]
annotation SummarizationSetBy = Automatic
hierarchy 'Date Hierarchy'
lineageTag: 1748d90b-b004-4b0d-afa9-77214627ce0f
level 'Calendar Year (ie 2021)'
lineageTag: ec183b08-c5d1-42ca-a087-e4dbfbcc9349
column: 'Calendar Year (ie 2021)'
level 'Calendar Quarter (ie Q1)'
lineageTag: 54cf79cd-0493-4918-9750-c334dcfe4eb5
column: 'Calendar Quarter (ie Q1)'
level 'Calendar Month (ie Jan)'
lineageTag: 7ab92588-0b9b-4b03-a4ee-a556e9b8cc1e
column: 'Calendar Month (ie Jan)'
level 'Calendar Week EU (ie WK25)'
lineageTag: 51e5883b-9124-4ff7-9600-954ef91e6f80
column: 'Calendar Week EU (ie WK25)'
level 'Weekday Short (i.e. Mon)'
lineageTag: 5aef54bd-34f0-47c9-b70c-21e5cf59e625
column: 'Weekday Short (i.e. Mon)'
level Date
lineageTag: cb95b6f4-85ff-4121-bb82-3e18125ac0db
column: Date
partition Date = calculated
mode: import
source = ```
-- Reference date for the latest date in the report
-- Until when the business wants to see data in reports
VAR _Refdate_Measure = [RefDate]
VAR _Today = TODAY ( )
-- Replace with "Today" if [RefDate] evaluates blank
VAR _ReferenceDate = IF ( ISBLANK ( _Refdate_Measure ), _Today, _Refdate_Measure )
VAR _RefYear = YEAR ( _ReferenceDate )
VAR _RefQuarter = _RefYear * 100 + QUARTER(_ReferenceDate)
VAR _RefMonth = _RefYear * 100 + MONTH(_ReferenceDate)
VAR _RefWeek_EU = _RefYear * 100 + WEEKNUM(_ReferenceDate, 2)
-- Earliest date in the model scope
VAR _EarliestDate = DATE ( YEAR ( MIN ( 'Orders'[Order Date] ) ) - 2, 1, 1 )
VAR _EarliestDate_Safe = MIN ( _EarliestDate, DATE ( YEAR ( _Today ) + 1, 1, 1 ) )
-- Latest date in the model scope
VAR _LatestDate_Safe = DATE ( YEAR ( _ReferenceDate ) + 2, 12, 1 )
------------------------------------------
-- Base calendar table
VAR _Base_Calendar = CALENDAR ( _EarliestDate_Safe, _LatestDate_Safe )
------------------------------------------
------------------------------------------
VAR _IntermediateResult =
ADDCOLUMNS ( _Base_Calendar,
------------------------------------------
"Calendar Year Number (ie 2021)", --|
YEAR ([Date]), --|-- Year
--|
"Calendar Year (ie 2021)", --|
FORMAT ([Date], "YYYY"), --|
------------------------------------------
------------------------------------------
"Calendar Quarter Year (ie Q1 2021)", --|
"Q" & --|-- Quarter
CONVERT(QUARTER([Date]), STRING) & --|
" " & --|
CONVERT(YEAR([Date]), STRING), --|
--|
"Calendar Year Quarter (ie 202101)", --|
YEAR([Date]) * 100 + QUARTER([Date]), --|
--|
"Calendar Quarter (ie Q1)", --|
"Q" & --|
CONVERT(QUARTER([Date]), STRING), --|
------------------------------------------
------------------------------------------
"Calendar Month Year (ie Jan 21)", --|
FORMAT ( [Date], "MMM YY" ), --|-- Month
--|
"Calendar Year Month (ie 202101)", --|
YEAR([Date]) * 100 + MONTH([Date]), --|
--|
"Calendar Month (ie Jan)", --|
FORMAT ( [Date], "MMM" ), --|
--|
"Calendar Month # (ie 1)", --|
MONTH ( [Date] ), --|
------------------------------------------
------------------------------------------
"Calendar Week EU (ie WK25)", --|
"WK" & WEEKNUM( [Date], 2 ), --|-- Week
--|
"Calendar Week Number EU (ie 25)", --|
WEEKNUM( [Date], 2 ), --|
--|
"Calendar Year Week Number EU (ie 202125)", --|
YEAR ( [Date] ) * 100 --|
+ --|
WEEKNUM( [Date], 2 ), --|
--|
"Calendar Week US (ie WK25)", --|
"WK" & WEEKNUM( [Date], 1 ), --|
--|
"Calendar Week Number US (ie 25)", --|
WEEKNUM( [Date], 1 ), --|
--|
"Calendar Year Week Number US (ie 202125)", --|
YEAR ( [Date] ) * 100 --|
+ --|
WEEKNUM( [Date], 1 ), --|
--|
"Calendar Week ISO (ie WK25)", --|
"WK" & WEEKNUM( [Date], 21 ), --|
--|
"Calendar Week Number ISO (ie 25)", --|
WEEKNUM( [Date], 21 ), --|
--|
"Calendar Year Week Number ISO (ie 202125)",--|
YEAR ( [Date] ) * 100 --|
+ --|
WEEKNUM( [Date], 21 ), --|
------------------------------------------
------------------------------------------
"Weekday Short (i.e. Mon)", --|
FORMAT ( [Date], "DDD" ), --|-- Weekday
--|
"Weekday Name (i.e. Monday)", --|
FORMAT ( [Date], "DDDD" ), --|
--|
"Weekday Number EU (i.e. 1)", --|
WEEKDAY ( [Date], 2 ), --|
------------------------------------------
------------------------------------------
"Calendar Month Day (i.e. Jan 05)", --|
FORMAT ( [Date], "MMM DD" ), --|-- Day
--|
"Calendar Month Day (i.e. 0105)", --|
MONTH([Date]) * 100 --|
+ --|
DAY([Date]), --|
--|
"YYYYMMDD", --|
YEAR ( [Date] ) * 10000 --|
+ --|
MONTH ( [Date] ) * 100 --|
+ --|
DAY ( [Date] ), --|
------------------------------------------
------------------------------------------
"IsDateInScope", --|
[Date] <= _ReferenceDate --|-- Boolean
&& --|
YEAR([Date]) > YEAR(_EarliestDate), --|
--|
"IsBeforeThisMonth", --|
[Date] <= EOMONTH ( _ReferenceDate, -1 ), --|
--|
"IsLastMonth", --|
[Date] <= EOMONTH ( _ReferenceDate, 0 ) --|
&& --|
[Date] > EOMONTH ( _ReferenceDate, -1 ), --|
--|
"IsYTD", --|
MONTH([Date]) --|
<= --|
MONTH(EOMONTH ( _ReferenceDate, 0 )), --|
--|
"IsActualToday", --|
[Date] = _Today, --|
--|
"IsRefDate", --|
[Date] = _ReferenceDate, --|
--|
"IsHoliday", --|
MONTH([Date]) * 100 --|
+ --|
DAY([Date]) --|
IN {0101, 0501, 1111, 1225}, --|
--|
"IsWeekday", --|
WEEKDAY([Date], 2) --|
IN {1, 2, 3, 4, 5}) --|
------------------------------------------
VAR _Result =
--------------------------------------------
ADDCOLUMNS ( --|
_IntermediateResult, --|-- Boolean #2
"IsThisYear", --|
[Calendar Year Number (ie 2021)] --|
= _RefYear, --|
--|
"IsThisMonth", --|
[Calendar Year Month (ie 202101)] --|
= _RefMonth, --|
--|
"IsThisQuarter", --|
[Calendar Year Quarter (ie 202101)] --|
= _RefQuarter, --|
--|
"IsThisWeek", --|
[Calendar Year Week Number EU (ie 202125)]--|
= _RefWeek_EU --|
) --|
--------------------------------------------
RETURN
_Result
```
annotation TabularEditor_TableGroup = 01. Dimension Tables
table Employees
lineageTag: 524ed7be-f2f0-440f-9280-3b067d6f766e
column Role
dataType: string
displayFolder: Columns
lineageTag: 3d1387dd-01f0-4f13-ab38-811f06cd1359
summarizeBy: none
sourceColumn: Role
changedProperty = IsHidden
annotation SummarizationSetBy = Automatic
column 'Employee Name'
dataType: string
displayFolder: Columns
lineageTag: fc711d7b-da3f-4e5e-9c68-0073c2489c1a
summarizeBy: none
sourceColumn: Employee Name
changedProperty = IsHidden
annotation SummarizationSetBy = Automatic
column 'Employee Email'
dataType: string
displayFolder: Columns
lineageTag: e4e18027-3292-4531-9c47-c0d2bd3d8efb
summarizeBy: none
sourceColumn: Employee Email
changedProperty = IsHidden
annotation SummarizationSetBy = Automatic
column 'Data Security Rule'
dataType: string
displayFolder: Columns
lineageTag: b08c9506-5704-406c-a5f5-5ea65d6623b8
summarizeBy: none
sourceColumn: Data Security Rule
changedProperty = IsHidden
annotation SummarizationSetBy = Automatic
partition Employees = m
mode: import
queryGroup: Tables
source =
let
Source = Sql.Database(#"SqlEndpoint",#"Database"),
Data = Source{[Schema="Dimview",Item="Employees"]}[Data]
in
Data
changedProperty = IsHidden
annotation PBI_NavigationStepName = Navigation
annotation PBI_ResultType = Table
annotation TabularEditor_TableGroup = 01. Dimension Tables
table 'Exchange Rate'
lineageTag: 01ee8527-a2dc-471d-9a3d-9ccfe51284ef
column 'Rate Type'
dataType: string
isHidden
displayFolder: 2. Other Currency Fields
lineageTag: 452c5cfd-c704-4b98-be56-71082368b44b
summarizeBy: none
sourceColumn: Rate Type
annotation SummarizationSetBy = Automatic
column 'From Currency'
dataType: string
displayFolder: 1. Select a Currency
lineageTag: ee8bbaa9-0b3e-42bf-9d01-d907458159bc
summarizeBy: none
sourceColumn: From Currency
annotation SummarizationSetBy = Automatic
column 'To Currency'
dataType: string
isHidden
displayFolder: 2. Other Currency Fields
lineageTag: 7640e9c9-9b46-48e7-bdaa-c96bb487b625
summarizeBy: none
sourceColumn: To Currency
annotation SummarizationSetBy = Automatic
column 'Currency System'
dataType: string
isHidden
displayFolder: 2. Other Currency Fields
lineageTag: ee01193c-1f42-4aec-a1fc-45db6cabfb80
summarizeBy: none
sourceColumn: Currency System
annotation SummarizationSetBy = Automatic
column Rate
dataType: double
isHidden
displayFolder: 2. Other Currency Fields
lineageTag: c7c98d7b-101b-4fb0-b4b6-a1990adb1ecb
summarizeBy: sum
sourceColumn: Rate
annotation SummarizationSetBy = Automatic
annotation PBI_FormatHint = {"isGeneralNumber":true}
column Date
dataType: dateTime
isHidden
displayFolder: 2. Other Currency Fields
lineageTag: 024862a6-5e54-4cc6-a1d7-2b7b1f393ad6
summarizeBy: none
sourceColumn: Date
annotation SummarizationSetBy = Automatic
column Month
dataType: string
isHidden
displayFolder: 2. Other Currency Fields
lineageTag: fe0e261d-d4be-49a5-b2d0-a644f272b0eb
summarizeBy: none
sourceColumn: Month
annotation SummarizationSetBy = Automatic
column 'Exchange Rate Composite Key'
dataType: string
isHidden
displayFolder: 2. Other Currency Fields
lineageTag: 5b3738b3-2625-4510-909a-71dd86316090
summarizeBy: none
sourceColumn: Exchange Rate Composite Key
annotation SummarizationSetBy = Automatic
column 'Currency Symbol'
dataType: string
isHidden
displayFolder: 2. Other Currency Fields
lineageTag: 5ebc638f-a523-4f0e-ae44-609c8bb9135e
summarizeBy: none
sourceColumn: Currency Symbol
annotation SummarizationSetBy = Automatic
column Position
dataType: string
isHidden
displayFolder: 2. Other Currency Fields
lineageTag: 339aa5d5-e96b-4841-8c9f-91d2518298b8
summarizeBy: none
sourceColumn: Position
annotation SummarizationSetBy = Automatic
column 'Format String'
dataType: string
isHidden
displayFolder: 2. Other Currency Fields
lineageTag: 9e55602e-4e1d-45e7-b00c-b88a0ddc696a
summarizeBy: none
sourceColumn: Format String
annotation SummarizationSetBy = Automatic
partition 'Exchange Rate' = m
mode: import
queryGroup: Tables
source = ```
let
Source = Sql.Database(#"SqlEndpoint",#"Database"),
Data = Source{[Schema="Dimview",Item="Exchange Rate"]}[Data],
// Add currency symbol column based on currency code
AddCurrencySymbol = Table.AddColumn(Data, "Currency Symbol", each
if [From Currency] = "EUR" then "€"
else if [From Currency] = "ZAR" then "R"
else if [From Currency] = "ARC" then "₳"
else if [From Currency] = "BELT" then "฿"
else if [From Currency] = "BLO" then "Ł"
else if [From Currency] = "BLT" then "₺"
else if [From Currency] = "CAL" then "¢"
else if [From Currency] = "CREDITS" then "₡"
else if [From Currency] = "ELD" then "Ξ"
else if [From Currency] = "HAL" then "Ħ"
else if [From Currency] = "ILOS" then "ł"
else if [From Currency] = "LAK" then "₭"
else if [From Currency] = "MCR" then "₥"
else if [From Currency] = "OTN" then "Ø"
else if [From Currency] = "UPN" then "Ʉ"
else null,
type text),
// Add position column (prefix or suffix)
AddPosition = Table.AddColumn(AddCurrencySymbol, "Position", each
if List.Contains({"EUR", "BLO", "CAL", "ELD", "ILOS", "UPN"}, [From Currency]) then "suffix"
else "prefix",
type text),
// Add format string for Power BI (without decimals)
AddFormatString = Table.AddColumn(AddPosition, "Format String", each
if [From Currency] = "EUR" then "#,##0 €"
else if [From Currency] = "ZAR" then "R #,##0"
else if [From Currency] = "ARC" then "₳ #,##0"
else if [From Currency] = "BELT" then "฿ #,##0"
else if [From Currency] = "BLO" then "#,##0 Ł"
else if [From Currency] = "BLT" then "₺ #,##0"
else if [From Currency] = "CAL" then "#,##0 ¢"
else if [From Currency] = "CREDITS" then "₡ #,##0"
else if [From Currency] = "ELD" then "#,##0 Ξ"
else if [From Currency] = "HAL" then "Ħ #,##0"
else if [From Currency] = "ILOS" then "#,##0 ł"
else if [From Currency] = "LAK" then "₭ #,##0"
else if [From Currency] = "MCR" then "₥ #,##0"
else if [From Currency] = "OTN" then "Ø #,##0"
else if [From Currency] = "UPN" then "#,##0 Ʉ"
else "#,##0",
type text)
in
AddFormatString
```
annotation PBI_NavigationStepName = Navigation
annotation PBI_ResultType = Table
annotation TabularEditor_TableGroup = 01. Dimension Tables
table Forecast
lineageTag: f44175ec-6e73-4cc5-93db-4febba622528
measure 'Forecast MTD' = ```
-- Calculates the target for the current month/year selection
VAR _CURRENT_MONTH_VALUE =
CALCULATE (
[Forecast],
ALL ( 'Date' ),
VALUES ( 'Date'[Calendar Month Year (ie Jan 21)] )
)
-- Computes rate at which Forecast increases through the month
VAR _CURRENT_MONTH_PERC_WORKDAYS_MTD =
POWER (
CALCULATE (
MAX ( 'Date'[Workdays MTD %] ),
'Date'[IsDateInScope] = TRUE
),
1.035
)
VAR _CURRENT_MONTH_PERC_WORKDAYS =
POWER (
CALCULATE (
MAX ( 'Date'[Workdays MTD %] )
),
1.035
)
VAR _PERIOD =
SELECTEDVALUE (
'4) Selected Period'[Period]
)
VAR _HASONEMONTH =
HASONEVALUE (
'Date'[Calendar Month Year (ie Jan 21)]
)
RETURN
-- return MTD value if a month is selected
IF.EAGER (
_HASONEMONTH
&& _PERIOD = "Full Period",
_CURRENT_MONTH_PERC_WORKDAYS
* _CURRENT_MONTH_VALUE,
IF (
_HASONEMONTH,
_CURRENT_MONTH_PERC_WORKDAYS_MTD
* _CURRENT_MONTH_VALUE
)
)
```
formatString: #,##0
displayFolder: Measures\ii. MTD
lineageTag: 59b4471b-3cce-43f5-ab24-5555faf2bd37
measure 'Forecast QTD' =
VAR _DATES_QTD =
CALCULATETABLE (
DATESQTD ('Date'[Date]),
'Date'[IsThisMonth] = FALSE
)
VAR _CURRENT_MONTH_Forecast = [Forecast MTD]
VAR _QTD_Forecast_BEFORE_THIS_MONTH = CALCULATE ([Forecast], _DATES_QTD)
VAR _RESULT = _CURRENT_MONTH_Forecast + _QTD_Forecast_BEFORE_THIS_MONTH
RETURN
_RESULT
formatString: #,##0
displayFolder: Measures\iii. QTD
lineageTag: b016de82-c11c-4231-a206-c2d02568aa7f
measure 'Forecast QTD vs. Turnover (%)' =
VAR _TARGET = [Forecast QTD]
VAR _DELTA = [Turnover] - [Forecast QTD]
VAR _PERC = DIVIDE ( _DELTA, _TARGET )
RETURN
_PERC
formatString: #,##0.0% ↑;#,##0.0% ↓;#,##0.0%
displayFolder: Measures\iii. QTD
lineageTag: 5fc59186-997c-4890-a18b-97e7662b0667
measure 'Forecast QTD vs. Turnover (Δ)' =
[Turnover] - [Forecast QTD]
formatString: #,##0 ↑;#,##0 ↓;#,##0
displayFolder: Measures\iii. QTD
lineageTag: 86a370f9-61ff-46d1-a054-614a604cf185
measure 'Forecast YTD' =
VAR _DATES_YTD =
CALCULATETABLE (
DATESYTD ('Date'[Date]),
'Date'[IsThisMonth] = FALSE
)
VAR _CURRENT_MONTH_Forecast = [Forecast MTD]
VAR _QTD_Forecast_BEFORE_THIS_MONTH = CALCULATE ([Forecast], _DATES_YTD)
VAR _RESULT = _CURRENT_MONTH_Forecast + _QTD_Forecast_BEFORE_THIS_MONTH
RETURN
_RESULT
formatString: #,##0
displayFolder: Measures\iv. YTD
lineageTag: 8db40d35-8818-45fb-b008-f39e79ba3084
measure 'Forecast YTD vs. Turnover (%)' =
VAR _TARGET = [Forecast YTD]
VAR _DELTA = [Turnover] - [Forecast YTD]
VAR _PERC = DIVIDE ( _DELTA, _TARGET )
RETURN
_PERC
formatString: #,##0.0% ↑;#,##0.0% ↓;#,##0.0%
displayFolder: Measures\iv. YTD
lineageTag: 8d1f9942-e438-4edf-99fb-a244511fb73f
measure 'Forecast YTD vs. Turnover (Δ)' =
[Turnover] - [Forecast YTD]
formatString: #,##0 ↑;#,##0 ↓;#,##0
displayFolder: Measures\iv. YTD
lineageTag: 1a4e0d88-e751-4350-bf75-3cb5aab8e7c1
measure 'Total Forecast' = ```
VAR _SelectedRate = MAX ( 'Exchange Rate'[Rate] )
RETURN
SUM ( 'Forecast'[Forecast (EUR)] ) * _SelectedRate
```
formatString: #,##0
displayFolder: Measures\i. Total
lineageTag: 66dd4eca-8cd0-492a-b93a-0bb91c4f6b04
measure Forecast = ```
IF.EAGER(
HASONEVALUE( '2) Selected Unit'[Select a Unit] )
&&
HASONEVALUE( 'Exchange Rate'[From Currency] ),
VAR _SELECTED_CURRENCY =
SELECTEDVALUE( 'Exchange Rate'[From Currency] )
VAR _SELECTED_RATE_TYPE =
SELECTEDVALUE( '2) Selected Unit'[Select a Unit] )
VAR _SELECTED_BUDGET_RATE =
MAX( 'Exchange Rate'[Rate] )
VAR _SELECTED_MONTHLY_RATE =
ADDCOLUMNS(
SUMMARIZE(
'Exchange Rate',
'Date'[Calendar Month Year (ie Jan 21)]
),
"Curr",
CALCULATE (
MAX( 'Exchange Rate'[Rate] )
)
)
RETURN
IF(
_SELECTED_RATE_TYPE = "Value (Budget Rate)",
SUM ( 'Forecast'[Forecast (EUR)])
*
_SELECTED_BUDGET_RATE,
IF(
_SELECTED_RATE_TYPE = "Value (Monthly Rate)",
SUMX(
_SELECTED_MONTHLY_RATE,
CALCULATE(
SUM ( 'Forecast'[Forecast (EUR)])
)
* [Curr]
)
)
)
)
```
formatString: #,##0
displayFolder: Measures\i. Total
lineageTag: a6383680-00ad-44a2-a972-afd4378179ad
measure 'Forecast MTD vs. Turnover (%)' =
VAR _TARGET = [Forecast MTD]
VAR _DELTA = [MTD Turnover] - _TARGET
VAR _PERC = DIVIDE ( _DELTA, _TARGET )
RETURN
_PERC
formatString: #,##0.0% ↑;#,##0.0% ↓;#,##0.0%
displayFolder: Measures\ii. MTD
lineageTag: 852154a6-c9a0-46bc-bc2f-f27301426027
measure 'Forecast MTD vs. Turnover (Δ)' =
[MTD Turnover] - [Forecast MTD]
formatString: #,##0 ↑;#,##0 ↓;#,##0
displayFolder: Measures\ii. MTD
lineageTag: 32e7cb6e-42b1-4549-ac5a-4dcd6d678b1c
measure 'Forecast vs. Turnover (%)' =
VAR _TARGET = [Forecast]
VAR _DELTA = [Turnover] - _TARGET
VAR _PERC = DIVIDE ( _DELTA, _TARGET )
RETURN
_PERC
formatString: #,##0.0% ↑;#,##0.0% ↓;#,##0.0%
displayFolder: Measures\i. Total
lineageTag: 0f955ab8-28e0-4ac4-b335-23c88440db41
measure 'Forecast vs. Turnover (Δ)' =
[Turnover] - [Forecast]
formatString: #,##0 ↑;#,##0 ↓;#,##0
displayFolder: Measures\i. Total
lineageTag: 68c5bb1f-fa70-42a1-8f9c-34f95ed0950b
column 'Forecast Month'
dataType: dateTime
isHidden
formatString: Long Date
displayFolder: 2. Keys
lineageTag: 1c521f45-cb4d-444a-94da-8684fd62cf37
summarizeBy: none
sourceColumn: Forecast Month
annotation SummarizationSetBy = Automatic
annotation UnderlyingDateTimeDataType = Date
column 'Region Territory'
dataType: string
isHidden
displayFolder: 2. Keys
lineageTag: 864f2700-e020-4b14-98ce-7e5b4154275d
summarizeBy: none
sourceColumn: Region Territory
annotation SummarizationSetBy = Automatic
column 'Product Type'
dataType: string
isHidden
displayFolder: 2. Keys
lineageTag: a3e38e2f-113c-4b33-97bd-ba68256feaff
summarizeBy: none
sourceColumn: Product Type
annotation SummarizationSetBy = Automatic
column 'Forecast (EUR)'
dataType: int64
isHidden
displayFolder: 1. Facts
lineageTag: 68c093b8-8ce0-44cc-ab2c-213dcc900077
summarizeBy: sum
sourceColumn: Forecast (EUR)
annotation SummarizationSetBy = Automatic
partition Forecast = m
mode: import
queryGroup: Tables
source = ```
let
Source = Sql.Database(
#"SqlEndpoint",
#"Database"
),
Data = Source
{
[
Schema = "Factview",
Item = "Forecast"
]
}[Data],
#"Select Columns" = Table.SelectColumns(
Data,
{
"Forecast Month",
"Forecast (EUR)",
"Region Territory",
"Product Type"
}
)
in
#"Select Columns"
```
annotation PBI_NavigationStepName = Navigation
annotation PBI_ResultType = Table
annotation TabularEditor_TableGroup = 02. Fact Tables
table 'FP - MTD'
lineageTag: 7b25559c-6025-444f-bba9-985e57c81e5c
column 'FP - MTD'
lineageTag: b503781d-db8d-4091-ac37-6fa0ff05de01
summarizeBy: none
sourceColumn: [Value1]
sortByColumn: 'FP - MTD Order'
relatedColumnDetails
groupByColumn: 'FP - MTD Fields'
annotation SummarizationSetBy = Automatic
column 'FP - MTD Fields'
isHidden
lineageTag: b467be59-aaa1-4bf7-8c3c-90bdae167bb4
summarizeBy: none
sourceColumn: [Value2]
sortByColumn: 'FP - MTD Order'
extendedProperty ParameterMetadata =
{
"version": 3,
"kind": 2
}
annotation SummarizationSetBy = Automatic
column 'FP - MTD Order'
isHidden
formatString: 0
lineageTag: 91f5c4a5-41df-41a4-bcdf-16f4d8000033
summarizeBy: sum
sourceColumn: [Value3]
annotation SummarizationSetBy = Automatic
partition 'FP - MTD' = calculated
mode: import
source =
{
(
"Actuals",
NAMEOF ( [Actuals MTD - UDF] ),
0
),
(
"Target",
NAMEOF ( [Sales Target MTD - UDF] ),
1
)
}
annotation PBI_Id = 933c9197a6224078a97c9772b81c52a0
annotation TabularEditor_TableGroup = 05. Parameters
table 'Invoice Document Type'
lineageTag: dbcc3ac6-9a34-4dc6-8477-078cb12b3dd4
column 'Billing Document Type Code'
dataType: string
displayFolder: 2. Keys
lineageTag: e9a08be0-7588-41c4-bc84-7d10ed0d5d0f
summarizeBy: none
sourceColumn: Billing Document Type Code
sortByColumn: 'Doc. Type Ordinal'
annotation SummarizationSetBy = Automatic
column Text
dataType: string
displayFolder: 1. Billing Doc. Type
lineageTag: b90274be-9a59-4782-b817-fe6c65a5c0b3
summarizeBy: none
sourceColumn: Text
sortByColumn: 'Doc. Type Ordinal'
annotation SummarizationSetBy = Automatic
column 'Doc. Type Ordinal'
dataType: int64
isHidden
displayFolder: 3. Ordinal
lineageTag: 3439cdad-fc7d-4cfb-9b69-26b03bd3ef65
summarizeBy: none
sourceColumn: Doc. Type Ordinal
annotation SummarizationSetBy = Automatic
column Group
dataType: string
displayFolder: 1. Billing Doc. Type
lineageTag: 494309fe-449d-447a-9522-5aaac15890e8
summarizeBy: none
sourceColumn: Group
sortByColumn: 'Group Ordinal'
annotation SummarizationSetBy = Automatic
column 'Group Ordinal'
dataType: int64
isHidden
displayFolder: 3. Ordinal
lineageTag: 5c8de158-176b-43a0-aa9d-5314d4b4ded6
summarizeBy: none
sourceColumn: Group Ordinal
annotation SummarizationSetBy = Automatic
partition 'Invoice Document Type' = m
mode: import
queryGroup: Tables
source =
let
Source = Sql.Database(#"SqlEndpoint",#"Database"),
Data = Source{[Schema="Dimview",Item="Invoice Document Type"]}[Data]
in
Data
annotation PBI_NavigationStepName = Navigation
annotation PBI_ResultType = Table
annotation TabularEditor_TableGroup = 01. Dimension Tables
table 'Last Refresh'
lineageTag: 8df9a87e-0917-4ec3-8a2f-297dbfaa148e
column 'Last Refresh'
dataType: dateTime
formatString: General Date
lineageTag: 427dcc41-8ebd-4730-9cb4-9295708e7591
summarizeBy: none
sourceColumn: Last Refresh
variation Variation
isDefault
relationship: cf55bb82-b832-4bdf-bc81-c415a3504ae9
defaultHierarchy: LocalDateTable_595bdce4-ba17-4e98-90af-2d00b0a66670.'Date Hierarchy'
annotation SummarizationSetBy = Automatic
partition 'Last Refresh-01ea78bc-dff4-4eac-b58e-527fab59801b' = m
mode: import
queryGroup: 'Scalar Values'
source =
let
Source = DateTimeZone.FixedLocalNow()
in
Source
annotation PBI_NavigationStepName = Navigation
annotation PBI_ResultType = DateTimeZone
annotation TabularEditor_TableGroup = 03. Other Tables
table 'Order Document Type'
lineageTag: 8f2bc030-d173-42c1-9fc4-26bdc4efcbca
column 'Sales Order Document Type Code'
dataType: string
isHidden
displayFolder: 2. Keys
lineageTag: 3370b74d-45ca-4aee-9dfa-3578ad1b476f
summarizeBy: none
sourceColumn: Sales Order Document Type Code
annotation SummarizationSetBy = Automatic
column Text
dataType: string
displayFolder: 1. Order Doc. Type
lineageTag: dd298654-70aa-4357-a16e-7cf6eebe5e0f
summarizeBy: none
sourceColumn: Text
annotation SummarizationSetBy = Automatic
column 'Doc. Type Ordinal'
dataType: int64
isHidden
displayFolder: 3. Ordinal
lineageTag: f010755d-dc7c-4add-8bfd-a679f33ef0e5
summarizeBy: none
sourceColumn: Doc. Type Ordinal
annotation SummarizationSetBy = Automatic
column Group
dataType: string
displayFolder: 1. Order Doc. Type
lineageTag: f6aaeee2-b14c-47b1-9658-cdf317f44195
summarizeBy: none
sourceColumn: Group
annotation SummarizationSetBy = Automatic
column 'Group Ordinal'
dataType: int64
isHidden
displayFolder: 3. Ordinal
lineageTag: 1ce7a8e9-fe9f-4c9e-b106-4464b5c9419d
summarizeBy: none
sourceColumn: Group Ordinal
annotation SummarizationSetBy = Automatic
partition 'Order Document Type' = m
mode: import
queryGroup: Tables
source =
let
Source = Sql.Database(#"SqlEndpoint",#"Database"),
Data = Source{[Schema="Dimview",Item="Order Document Type"]}[Data]
in
Data
annotation PBI_NavigationStepName = Navigation
annotation PBI_ResultType = Table
annotation TabularEditor_TableGroup = 01. Dimension Tables
table 'Z02CG1 - Unit'
isHidden
lineageTag: 516121f5-e575-4aef-9915-f766b1aa72e0
calculationGroup
precedence: 2
calculationItem 'Value (Budget Rate)' =
[Value]
calculationItem Quantity =
[Quantity]
calculationItem Lines =
[Lines]
column Unit
dataType: string
isHidden
lineageTag: 2d7160af-d5c1-4676-b064-a01f4f8cd651
summarizeBy: none
sourceColumn: Name
sortByColumn: Ordinal
annotation SummarizationSetBy = Automatic
column Ordinal
dataType: int64
isHidden
lineageTag: c3a035d1-b935-4d28-9654-7b1f0468e8e2
summarizeBy: sum
sourceColumn: Ordinal
annotation SummarizationSetBy = Automatic
annotation TabularEditor_TableGroup = 06. Calculation Groups