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
amilkarigi
Helper I
Helper I

How do I compare sold products from a previous year vs actual year?

Hi so I am trying do a comparisson of products where I need to find my most sold product that wasn't sell the previous year.

For example in the image below you see in 2012 I sold 0 Jack Flash Dresses but in 2013 it was the most sold product of the ones I didn't sell in 2012. 

Captura.PNG

Well I need to put that product in a Card chart using a mesure, the one I have is this one:

Mas Vendido = TOPN(1; ALL(Productos[ProductName]); [Ventas Total];DESC)

This calculate most sold product of the year, it doesn't consider the actual/previous year comparisson.

1 ACCEPTED SOLUTION
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi amilkarigi,

 

If I understand your scenario correctly that you want to have a measure to calculate the most sold product of the year with comparison of the actual and previous year. You could try to modify your measure to Mas Vendido = TOPN (1,Filter(All(Productos[ProductName]),Condition(Values in Q2012=null),[ Ventas Total],DESC). You should filter the table which the sold of Q2012 is zero first, and then you could rank the sold of Q2013.

 

If you cannot create the measure, could you share a dummy pbix file which can reproduce the scenario, so that I can do some tests and create the measure for you. You can upload it to OneDrive or Dropbox and post the link here. Do mask sensitive data before uploading.)

 

Best Regards,

Cherry  

Community Support Team _ Cherry Gao
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

3 REPLIES 3
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi amilkarigi,

 

If I understand your scenario correctly that you want to have a measure to calculate the most sold product of the year with comparison of the actual and previous year. You could try to modify your measure to Mas Vendido = TOPN (1,Filter(All(Productos[ProductName]),Condition(Values in Q2012=null),[ Ventas Total],DESC). You should filter the table which the sold of Q2012 is zero first, and then you could rank the sold of Q2013.

 

If you cannot create the measure, could you share a dummy pbix file which can reproduce the scenario, so that I can do some tests and create the measure for you. You can upload it to OneDrive or Dropbox and post the link here. Do mask sensitive data before uploading.)

 

Best Regards,

Cherry  

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

Thanks, a lot. Could you help me with this RANKKX Issue?

amilkarigi
Helper I
Helper I

I'm having a huge problem and it's that I need to a measure to compare my sales from a previous year to the actual year and find my top sold product that wasn't sell the previous year. For example if the previous year I sold zero Converse, zero Vans and 3 Adidas and in the actual year I sold 10 Converse, 11 Vans and 20 Adidas, Vans should be my "Top Product" regardless if I sold 20 Adidas becuase it was sold the previous year.

 

Here's what I have until now:

TopProduct = FIRSTNONBLANK(TOPN(1; ALL(Products[ProductName]);[Total Sales];DESC); 1)

 

The code is missing the comparison between years, becuase this code return my top produt, but from all the one i sold and doesn't consider the previous/actual year condition.

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.