Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
example:
- in a run-of-the-mill "orders" table I'm summing "orderedQuantity" over a period of "orderDate".
- orderDate is filtered using a relative filter of "Last 1 month"
- so far so good.
- i also made a measure called "quantity - last year" using sameperiodlastyear (* see below)
- when i sum "quantity - last year", i get bogus (=visibly inflated) numbers.
took me some time to figure out that the problem disappears when i exclude today from the date filter. (or when i filter the day using Between and choose the next-to-last day as the end date.)
interestingly, when graphed in a chart, the last year totals are always correct - each day's total is displayed correctly (see screen below). the problem is only manifested in a sum, such as on a Card.
any idea what i'm doing wrong? or if it is a bug?
Further details:
- the exact formula i use is as follows: quantity-LY = CALCULATE(SUM('table'[quantity]), SAMEPERIODLASTYEAR('table'[orderDate])) )
- the table i use is a view in MSSQL, imported data (not live connect)
- here's a screenshot where the problem is apparent: http://prntscr.com/voir5z
Solved! Go to Solution.
@Masaoka , Time intelligence function need continuous dates, so you use date from the date any date missed will lead to the wrong result or error
makes sense.
i still think the app should at least indicate this problem.
thanks!
i see. you're right, that should work.
is this a bug? or is using the table's native date hierarchy not recommended for time intel funcions?
thanks!
@Masaoka , Time intelligence function need continuous dates, so you use date from the date any date missed will lead to the wrong result or error
@Masaoka , Try with date table
Year behind Sales = CALCULATE(SUM('table'[quantity]),dateadd('Date'[Date],-1,Year))
quantity-LY = CALCULATE(SUM('table'[quantity]), SAMEPERIODLASTYEAR('Date'[Date]))
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 5 | |
| 5 | |
| 4 | |
| 4 | |
| 3 |
| User | Count |
|---|---|
| 24 | |
| 21 | |
| 13 | |
| 10 | |
| 8 |