Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
47 | |
26 | |
19 | |
14 | |
10 |
User | Count |
---|---|
58 | |
50 | |
44 | |
19 | |
18 |