Showing results for 
Search instead for 
Did you mean: 
sathish_P Frequent Visitor
Frequent Visitor

Year comparison

Hi all,

      I want to compare previous year with current year. In that comparison i want to assign all the starting date of the all the months of previous year as "X" and the rest is "Y" and ending date of all the months of current year as "X" and the rest is "Y".If i add next year data the position of "X" and "Y" should change dynamically as we are now camparing the current year with next year. i used switch statement and  assigned for 2018 and 2019 but if i add 2020 i goes wrong. how do i do it dynamically?

This is the formula i have used:


List =
2018, if('Table'[day]=STARTOFMONTH('Table'[day]),"X","Y"),
2019, if('Table'[day]=ENDOFMONTH('Table'[day]),"X","Y")
Omega Established Member
Established Member

Re: Year comparison

Can you share sample data with expected results? 

sathish_P Frequent Visitor
Frequent Visitor

Re: Year comparison

Thank you for your Reply,

I will explain clearly,

The Sales ("Y") effect should be assessed every month on the same number of days and similar in nature(a Monday being compared to a Monday, and a Saturday to a Saturday). Any extra day is considered as Calendar effect ("X"). The month of June 2015 started on a Friday and ended on a Saturday, whereas the month of June 2014 started on a Thursday and ended on a Friday. Consequently, both the 1st Thursday of June 2014 and the last Saturday of June 2015 are considered as Time ("X") effect and the rest is ("Y").y1.png

Now i should assign all the matching days (days similar in nature) as "Y" and the not similar days as "X".

How should i assign it dynamically? 

Community Support Team
Community Support Team

Re: Year comparison

Hi @sathish_P ,


Did you have a CALENDAR table? How about changing the formula as below?


List =
2018, if('Table'[day]=STARTOFMONTH('CALENDAR'[date]),"X","Y"),
2019, if('Table'[day]=ENDOFMONTH('CALENDAR'[date]),"X","Y")
Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
sathish_P Frequent Visitor
Frequent Visitor

Re: Year comparison

I have used calender table 

Helpful resources

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

Virtual Launch Event

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Users Online
Currently online: 124 members 1,665 guests