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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Will_Ryu
Frequent Visitor

Y-o-Y change when year is available as a whole number ONLY

Would appreciate your guidance in getting Y-o-Y change when the Year is available as a whole number only, like so 2018, 2019 etc. And no  there is no Date column in the base data or a Year and Month column (from which a Date column can then be created). This is the data provided.

 

As you are alI aware, it is futile to convert that column into a Date column as it converts to {9 -12 July 1905}

 

If the sales year is region dependant and not calendar year based will it make a difference?

 

Since I am unable to upload a file, I have attached a table

 

Sales Year (Whole Number)Sales AmountCOGS
2017        11,928,556          6,889,539
2018        30,516,892        14,395,851
2019        42,895,110        21,022,703
2020        24,468,717        14,096,441

 

Thanks in advance, W

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi @Will_Ryu ,

Here are the steps you can follow:

1. Create measure.

Last Year =
SUMX(
    FILTER(ALL('Table'),
    'Table'[Sales Year]=MAX('Table'[Sales Year])-1),[Sales Amount])
LastY-CurrentY% =
DIVIDE(
    [Last Year],
SUMX(
    FILTER(ALL('Table'),
    'Table'[Sales Year]=MAX('Table'[Sales Year])),[Sales Amount])
    )

2. Result:

vyangliumsft_0-1661912714524.png

If you need pbix, please click here.

Y-o-Y change when year is available as a whole number ONLY.pbix

 

Best Regards,

Liu Yang

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

6 REPLIES 6
v-yangliu-msft
Community Support
Community Support

Hi @Will_Ryu ,

Here are the steps you can follow:

1. Create measure.

Last Year =
SUMX(
    FILTER(ALL('Table'),
    'Table'[Sales Year]=MAX('Table'[Sales Year])-1),[Sales Amount])
LastY-CurrentY% =
DIVIDE(
    [Last Year],
SUMX(
    FILTER(ALL('Table'),
    'Table'[Sales Year]=MAX('Table'[Sales Year])),[Sales Amount])
    )

2. Result:

vyangliumsft_0-1661912714524.png

If you need pbix, please click here.

Y-o-Y change when year is available as a whole number ONLY.pbix

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

HoangHugo
Solution Specialist
Solution Specialist

Hi

I understand you want to calulate Last year sales to define Y-o-Y with the column of Sales year. Please try this

Total_sale = SUM(Amount)

Last_year_sale = CALCULATE (Total_sale,'[Sales Year] -1)

Y-o-Y = (Total_sale-Last_year_sale)/Last_year_sale

Thank you Hugo

 

However, using your method, I got the following result

Sales YearSales AmountLYY-o-Y
201711928556109809275-89.14%
201830516892109809275-72.21%
201942895110109809275-60.94%
202024468717109809275-77.72%

Hi

Please try modify the measure Last_year_sale

 

Last_year_sale =

 var year = MAX (Sales year)

 return CALCULATE (Total_sale,year -1)

MahyarTF
Memorable Member
Memorable Member

Hi,

If I am not mistaken you are looking for the Year to Year changes. For this purpose :

1- In Power Query I created the Index column in the particular table :

MahyarTF_0-1661477916098.png

2- Then in Power BI, created the below Column :

_Previous Sales Amount = LOOKUPVALUE( Sheet130[Sales amount], Sheet130[Index], Sheet130[Index] -1)
3-Then this measure :
_Y-o-Y Changes = if( CALCULATE(sum(Sheet130[_Previous Sales Amount])) > 0 ,
                     CALCULATE(sum(Sheet130[Sales amount])) - CALCULATE(sum(Sheet130[_Previous Sales Amount]))
                     )
4- And then use this column/measure in visual :
MahyarTF_1-1661478599754.png

 

Appreciate your Kudos

Mahyartf

@MahyarTF  Your solution works great on the simple table with one entry for each year but I wasn't able to extend it to  this data set. 

 

Sales YearCountrySales Amount
2018Australia          2,699,691
2018Canada          3,704,560
2018France              456,704
2018Germany              552,620
2018United Kingdom              593,106
2018United States        15,854,209
2019Australia          2,221,468
2019Canada          5,908,467
2019France          2,119,601
2019Germany              663,592
2019United Kingdom          2,191,569
2019United States        20,965,411
2020Australia          5,734,177
2020Canada          6,742,743
2020France          4,675,251
2020Germany          3,662,088
2020United Kingdom          4,886,046
2020United States        26,177,970

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.