Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Vinothsusai
Helper III
Helper III

Comparision graph issue (Current Year Nov and Dec months data dislaying from Previous year data)

Hello,

I faced a issue on graph Cout column N and N-1 comparision that displays current year Nov and Dec months data is displaying from previous year.

 

Here my table(filtered only for 2020 and 2019 records). the table is in first page and graph in second page(drill through filter - Resource). i just navigate to graph  by drill through the record in first page. if i drill through date on year 2020 , the graph will compare current year 2020 and last year 2019. if i drill through 2019, the graph will compare current year 2019 and last year 2018.

 

DateTypeResourceDescriptionQuantityPrixCoutVentes
1/29/2019 23:00TempsSOCIETE FLEXMIND102 - Tenue de journaux8600.00 €600.00 € 
1/31/2019 23:00TempsSOCIETE FLEXMIND102 - Tenue de journaux10750.00 €750.00 € 
2/19/2019 23:00Acompte   106.00 € 106 €
3/19/2019 23:00Acompte   106.00 € 106 €
3/27/2019 23:00TempsSOCIETE FLEXMIND104 - Comptes annuels7.5562.50 €562.50 € 
4/19/2019 22:00Acompte   106.00 € 106 €
4/24/2019 22:00TempsSOCIETE FLEXMIND104 - Comptes annuels6450.00 €450.00 € 
5/19/2019 22:00Acompte   106.00 € 106 €
5/21/2019 22:00TempsSOCIETE FLEXMIND147 - CAC: mission générale4300.00 €300.00 € 
6/19/2019 22:00Acompte   106.00 € 106 €
6/19/2019 22:00TempsSOCIETE FLEXMIND000 - Avant-vente5375.00 €375.00 € 
7/16/2019 22:00TempsSOCIETE FLEXMIND104 - Comptes annuels3225.00 €225.00 € 
7/19/2019 22:00Acompte   106.00 € 106 €
8/14/2019 22:00TempsSOCIETE FLEXMIND104 - Comptes annuels5375.00 €375.00 € 
8/19/2019 22:00Acompte   106.00 € 106 €
9/19/2019 22:00Acompte   106.00 € 106 €
10/19/2019 22:00Acompte   106.00 € 106 €
11/11/2019 23:00TempsSOCIETE FLEXMIND102 - Tenue de journaux4.5337.50 €337.50 € 
11/19/2019 23:00Acompte   106.00 € 106 €
12/19/2019 23:00Acompte   106.00 € 106 €
12/19/2019 23:00TempsSOCIETE FLEXMIND103 - Situation175.00 €75.00 € 
12/30/2019 23:00Acompte   ######## 5,000 €
12/31/2019 23:00Forfait/FraisSOCIETE FLEXMIND3326.00 €326.00 € 
1/29/2020 23:00TempsSOCIETE FLEXMIND103 - Situation7525.00 €525.00 € 
1/31/2020 23:00Acompte   409.00 € 409 €
2/26/2020 23:00TempsSOCIETE FLEXMIND104 - Comptes annuels5.5412.50 €412.50 € 
2/29/2020 23:00Acompte   409.00 € 409 €
3/23/2020 23:00TempsSOCIETE FLEXMIND102 - Tenue de journaux3225.00 €225.00 € 
3/31/2020 22:00Acompte   409.00 € 409 €
4/22/2020 22:00TempsSOCIETE FLEXMIND102 - Tenue de journaux4300.00 €300.00 € 
4/30/2020 22:00Acompte   543.00 € 543 €
5/19/2020 22:00TempsSOCIETE FLEXMIND104 - Comptes annuels6450.00 €450.00 € 
5/31/2020 22:00Acompte   409.00 € 409 €
6/30/2020 22:00Acompte   409.00 € 409 €
7/31/2020 22:00Acompte   409.00 € 409 €
8/31/2020 22:00Acompte   409.00 € 409 €
9/30/2020 22:00Acompte   409.00 € 409 €
10/29/2020 23:00TempsSOCIETE FLEXMIND102 - Tenue de journaux175.00 €75.00 € 
10/31/2020 23:00Acompte   409.00 € 

409 €

 

 

 

1.png

 

 i used my formaula dax below

Current year

Current Year =
var date1=
MAX(msdyn_actuals[msdyn_documentdate]) return
CALCULATE (
[Measure Total of type Cout],
FILTER(msdyn_actuals, YEAR(msdyn_actuals[msdyn_documentdate]) = YEAR(date1)))
 
Last Year
Last Year =
var date1=
MAX(msdyn_actuals[msdyn_documentdate])
RETURN
CALCULATE (
[Measure Total of type Cout],
FILTER(msdyn_actuals, YEAR(msdyn_actuals[msdyn_documentdate]) = YEAR(date1)-1))
 
Please advise.
 
Thanks
Vinoth
1 ACCEPTED SOLUTION
Anonymous
Not applicable

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])))

14.png

 

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))

15.png

 

 

 

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.

View solution in original post

1 REPLY 1
Anonymous
Not applicable

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])))

14.png

 

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))

15.png

 

 

 

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.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors