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

Calculate YOY % at categroy level with product

I have a dataset where I have current year sales and last year sales at product and category leve. I need to calculate Year over year %. I was able to get YOY% but I have requirement where I need to show that YOY% value for category level even though I have product selected in the table.

 

YOY% = Divide(sales-last_yr_sales,last_yr_sales) 

So if you see look at screenshot in the left table I have yoy% showing at product level, but instead I need a way to show yoy% at category level like in the right table even when product is selected. So in my case in left table i need to show yoy% for apparel to be 30% and smartdevices to be 25%. Can someone please help me with this?Capture.PNG

 

 

 

Thanks in advance. 

1 ACCEPTED SOLUTION
v-yuezhe-msft
Employee
Employee

@Anonymous,

sales and last_yr_sales are measures, right? If so, you can create the following measure to get expected result.

Measure = DIVIDE(CALCULATE([sales],ALLEXCEPT(Table1,Table1[category]))-CALCULATE([last yr sales],ALLEXCEPT(Table1,Table1[category])),CALCULATE([last yr sales],ALLEXCEPT(Table1,Table1[category])))


For more details, please check attached PBIX file.


Regards,
Lydia

Community Support Team _ Lydia Zhang
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
v-yuezhe-msft
Employee
Employee

@Anonymous,

sales and last_yr_sales are measures, right? If so, you can create the following measure to get expected result.

Measure = DIVIDE(CALCULATE([sales],ALLEXCEPT(Table1,Table1[category]))-CALCULATE([last yr sales],ALLEXCEPT(Table1,Table1[category])),CALCULATE([last yr sales],ALLEXCEPT(Table1,Table1[category])))


For more details, please check attached PBIX file.


Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.