Forum Discussion
Anonymous
7 years agoNot applicable
Help with comparting data dates
Hi, I would like to do some calculations with the below data. YTD - which I know I could use the TOTALYTD + Filter TotalYTD - Actual = TOTALYTD(Sum('Table'[GM]),'Table'[Full Date],FILTER('Ta...
- 7 years ago
Hi Anonymous
The formula in your lastest post is correct to solve this problem.
So far, it is a useful workaround for your problem.
The penultimate one shows a incorrect formula.
MinDate =
CALCULATE (
MIN ( 'Table'[Full Date] ),
FILTER ( 'Table', 'Table'[Measure Version] = "Actual" ),
FILTER ( 'Table', 'Table'[Full Date] = YEAR ( 2018 ) ) //incorrect
)Please see reference how to use "calculate" with "filter"
https://www.sqlbi.com/articles/filter-arguments-in-calculate/
If the formula is used in a measure, you could use the following instead.
YTD Plan = VAR TableMaxDate = CALCULATE ( MAX ( 'Table'[Full Date] ), FILTER ( ALL ( 'Table' ), 'Table'[Measure Version] = "Actual" ) ) VAR MinDate = CALCULATE ( MIN ( 'Table'[Full Date] ), FILTER ( ALL ( 'Table' ), 'Table'[Measure Version] = "Actual" && YEAR ( 'Table'[Full Date] ) = 2018 //from the information, it seems it is no
need to add this part, if so,
you could delete this part ) ) RETURN CALCULATE ( SUM ( 'Table'[GM] ), FILTER ( 'Table', 'Table'[Measure Version] = "Plan" ), DATESBETWEEN ( DIM_Date[Date], MinDate, TableMaxDate ) )Best Regards
Maggie
Anonymous
7 years agoNot applicable
AnonymousAny joy with this?
Do you think that this is the correct approach to the problem?
As I also have the same issue where I will need to look at the same date range for this year for the Plan and RF data?
Thanks
Anonymous
7 years agoNot applicable
Hi,
The syntax error is in this part
FILTER('Table', etc.......
It needs to be
FILTER(Table, etc....
I tried to recreate your question and I got this:
Are the left two columns the result that you want?