| 1 | <h2>Comments</h2> |
| 2 | <pre><code>// This is a comment</code></pre> |
| 3 | <h2>Simple example</h2> |
| 4 | <pre><code> |
| 5 | Sales YTD := |
| 6 | CALCULATE ( |
| 7 | [Sales Amount], |
| 8 | DATESYTD( 'Date'[Date] ) |
| 9 | ) |
| 10 | </code></pre> |
| 11 | <h2>Full example</h2> |
| 12 | <pre><code> |
| 13 | Burn Rate (Hours) = |
| 14 | |
| 15 | // Only consider those projects which have been alread created |
| 16 | VAR filterDate = |
| 17 | FILTER ( |
| 18 | ALL ( 'Date'[Date] ), |
| 19 | 'Date'[Date] <= MAX('Date'[Date]) |
| 20 | ) |
| 21 | |
| 22 | RETURN |
| 23 | IF ( |
| 24 | // Show blank for months before project start |
| 25 | MAX ( 'Project'[Project Created Relative Months Pos] ) < SELECTEDVALUE ( 'Date'[Fiscal RelativeMonthPos] ), |
| 26 | BLANK (), |
| 27 | MIN( |
| 28 | 1, |
| 29 | DIVIDE ( |
| 30 | // Add 0 to consider months with no hours |
| 31 | [Hours Actual Billable] + 0, |
| 32 | CALCULATE ( |
| 33 | [Planned Hours] + 0, |
| 34 | filterDate |
| 35 | ) |
| 36 | ) |
| 37 | ) |
| 38 | ) |
| 39 | </code></pre> |