Forum Discussion
Problem with pulling latest value from a table based on date filter.
- 3 years ago
Hello Michael
Please take a look at this CPI.pbix
https://1drv.ms/u/s!AkcWVrMFkXs1h7Req7Ff1DU5YZAloQ?e=w1e46L
Any question please ask
Best regards
Bruno Costa | Continued Contributor
Did I help you to answer your question? Accepted my post as a solution! Appreciate your Kudos!! 👍
Take a look at the blog: PBI Portugal
Hello Michael
Please take a look at this CPI.pbix
https://1drv.ms/u/s!AkcWVrMFkXs1h7Req7Ff1DU5YZAloQ?e=w1e46L
Any question please ask
Best regards
Bruno Costa | Continued Contributor
Did I help you to answer your question? Accepted my post as a solution! Appreciate your Kudos!! 👍
Take a look at the blog: PBI Portugal
Hi onurbmiguel_ ,
I've been working with your solution but have noticed that it is returning only values for the 'Valid From' month, not all months between the valid from and valid to dates. This is fine when the user is just defaulting to all dates in the current year, but when they select a specified month (say July 2022) then the values returned are 'Blank'.
| YearMonth Text | % CPI Actuals | % CPI Targets |
| 2022 Mar | 67.90% | 68.00% |
| 2022 Apr | ||
| 2022 May | ||
| 2022 Jun | ||
| 2022 Jul | ||
| 2022 Aug |
% CPI Targets =
var _max = MAX('calendar'[Date])
var _value =
CALCULATE(
AVERAGE('CPI Targets'[CPI Target]),
'CPI Targets'[Valid From]<=_max,
'CPI Targets'[Valid To]>=_max
)
return
_value
Do you have any thoughts on why this is?
Cheers
Michael