Forum Discussion
Comparision graph issue (Current Year Nov and Dec months data dislaying from Previous year data)
- Anonymous5 years ago
Hi Vinothsusai ,
The reason for the error may be because your dax function uses "var date1=MAX(msdyn_actuals[msdyn_documentdate])".
It will filter out the maximum date. The maximum date of November and December is the data of 2019, so your Current Year measure will return the data for 2019 in November and December.
Below is my solution.
1.Create a new table using DAX.
Table = DISTINCT(SELECTCOLUMNS('msdyn_actuals',"Year",YEAR([Date])))2.Measures are as follows.
Current Year = var date1= SELECTEDVALUE('Table'[Year]) return CALCULATE ( [Measure Total of type Cout], FILTER(msdyn_actuals, [year] = date1))Last Year = var date1= SELECTEDVALUE('Table'[Year]) RETURN CALCULATE ( [Measure Total of type Cout], FILTER(msdyn_actuals, YEAR(msdyn_actuals[Date]) = date1-1))You can check more details from here.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Vinothsusai ,
The reason for the error may be because your dax function uses "var date1=MAX(msdyn_actuals[msdyn_documentdate])".
It will filter out the maximum date. The maximum date of November and December is the data of 2019, so your Current Year measure will return the data for 2019 in November and December.
Below is my solution.
1.Create a new table using DAX.
Table = DISTINCT(SELECTCOLUMNS('msdyn_actuals',"Year",YEAR([Date])))
2.Measures are as follows.
Current Year =
var date1=
SELECTEDVALUE('Table'[Year]) return
CALCULATE (
[Measure Total of type Cout],
FILTER(msdyn_actuals, [year] = date1))Last Year =
var date1=
SELECTEDVALUE('Table'[Year])
RETURN
CALCULATE (
[Measure Total of type Cout],
FILTER(msdyn_actuals, YEAR(msdyn_actuals[Date]) = date1-1))
You can check more details from here.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.