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
Anonymous
Not applicable

YoY percentage difference

Hi all -  trying to calculate the year over year % difference for diff. products. I was able to do it before, when my data was nicely arranged by columns (FY15 Revenue, FY15 Volume, FY15 Profitability; FY16 Revenue, FY16 Volume etc), but now I unpivoted the columns and I'm not able to do that anymore. Any way to work around this issue? 

Thanks so much!

 

 BI.data.snapshot.YoY.png

1 ACCEPTED SOLUTION
NAOS
Helper IV
Helper IV

Hi,


You will need a calendar table that includes a column with the "Year" values formated as in your table.
Once you have that use that column as the axis for your visual.

A couple of mesuares like the following should do the trick.
Revenue = CALCULATE(
                                       SUM(YourTable[Value]), YourTable[Rev.Vol.Profit.GP] = "Revenue")
Revenue previous year = CALCULATE([Revenue], SAMEPERIODLASTYEAR(YourNewCalendarTable[Date]))  /*Where [Date] is the key of YourNewCalendarTable table, in other words, the column with the unique values*/

Revenue%changeYoY =
VAR RevPrevYear = [Revenue previous year]
RETURN
DIVIDE([Revenue] - RevPrevYear, RevPrevYear, Blank()) /*I just like to be explicit about that Blank value, but not really necessary*/

This should work but note this is not how it should be done. It seems to me like you should have a simple column for Revenue values and one other for each of the other attributes in the Rev.Vol.Profit.GP column. 

Let me know how it goes!

View solution in original post

5 REPLIES 5
NAOS
Helper IV
Helper IV

Hi,


You will need a calendar table that includes a column with the "Year" values formated as in your table.
Once you have that use that column as the axis for your visual.

A couple of mesuares like the following should do the trick.
Revenue = CALCULATE(
                                       SUM(YourTable[Value]), YourTable[Rev.Vol.Profit.GP] = "Revenue")
Revenue previous year = CALCULATE([Revenue], SAMEPERIODLASTYEAR(YourNewCalendarTable[Date]))  /*Where [Date] is the key of YourNewCalendarTable table, in other words, the column with the unique values*/

Revenue%changeYoY =
VAR RevPrevYear = [Revenue previous year]
RETURN
DIVIDE([Revenue] - RevPrevYear, RevPrevYear, Blank()) /*I just like to be explicit about that Blank value, but not really necessary*/

This should work but note this is not how it should be done. It seems to me like you should have a simple column for Revenue values and one other for each of the other attributes in the Rev.Vol.Profit.GP column. 

Let me know how it goes!

Anonymous
Not applicable

Thanks, @NAOS, this worked! Also, based on your suggestion, I later managed to create separate columns for each of the attributes (usinf If statements), which makes it way easier for a newbie like me to handle work with the data and create visuals. Thanks again.

Hey @Anonymous! Im glad it worked.

You could also try using the query editor and pivot the column, instead of using the "if" statements. That will generate one column for each of the different values in the column you pivot. You will have to use another column for the values. In the table posted with the original question, I imagine you will want to pivot the "Attribute" field and use the "Value" column as the values...so basically reverse the operation that created those two columns in the first place.

If you do this then you will have to change your measures, but they will be even more simple 😉

v-frfei-msft
Community Support
Community Support

Hi @Anonymous,

 

Could you please share your sample data and excepted result to me?

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Anonymous
Not applicable

Hi @v-frfei-msft,

 

sample.data.PNGThis is approximately how my data looks like. I want to be able to show, for instance (in a table visual), that revenue for Product Series A increased 19.3% from FY16 to FY17, but decreased by 6.4% from '17 to '18. I was able to do that before unpivoting, by using a new quick measure-percentage difference. Not sure how to do it now.

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.