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

How to determine the effect on a total figure from a single product by excluding it

Hi folks, I am trying to determine the effect a single item has on the overall totals if I excluded it from last years total and this years total and divided those figures into each other. 

 

I have 3 tables

 

The first is a returns table

 

DateReturn IDProduct Name
01-Oct-201912358Apple
05-Dec-201926959Grape
28-Jan-202032659Banana
09-Jun-202065323Grape

 

The second is a Sales table

 

DateProduct NameSale Qty
01-Sep-2019Apple1
10-Oct-2019Grape1
10-Mar-2020Apple3
27-May-2020Grape4
06-Jul-2020Banana2

 

The last is a Calendar table 

 

Returns measure is - 

Total Returns = DISTINCTCOUNT('returns_table'[Return ID])
 
Sales measure is - 
Total Sales = Sum('Sales_table'[Sale Qty])
 
My "return rate", which is returns per million, is calculated using -
Return Rate = 1000000 * DISTINCTCOUNT(returns_table[Return ID])/SUM(Sales_table[Sale Qty])
 
I can calculate last year & this years Return rates using the following 2 measures
Return Rate YTD = 1000000* DIVIDE(
TOTALYTD(COUNT(returns_table[Return ID]),'Calendar'[Date]),TOTALYTD(SUM(Sales_table[Sale Qty]),'Calendar'[Date]) )
 
Return Rate YTD LY = CALCULATE([Return Rate],PREVIOUSYEAR('Calendar'[Date]))
 
I can then determine a ratio as 
Ratio = [Return Rate YTD]/[Return Rate YTD LY]
 
I end up with something like this
 
Product NameTotal ReturnsTotal SaleReturn RateReturn Rate YTDReturn Rate LYAdjusted Return Rate YTDAdjusted Return Rate YTD LYAdjusted Ratio
AppleXXXXX???
Grapexxxxx???
Bananaxxxxx???
 
Here is where I am getting stuck. The "Adjusted" Return Rates show the overall total Return Rate if the returns and sales for a given product was removed from the overall total. As an example, the Adjusted Return Rate YTD figure for Apple would be something like this:
(Total Returns for this year - Apple returns)/(Total sales for this year - Apple Sales)*1000000
 
I can't figure this one out though, some help would be appreciated
3 REPLIES 3
DaveCor
Helper I
Helper I

Hi @amitchandak  I was looking over your suggestion again and I played with it a bit to try get it to work but I'm still having no luck getting it to return a value

 

This was the only attempt of mine that didn't throw up errors but still doesn't return any values

Adjusted Return Rate YTD = 1000000 * DIVIDE(
(calculate([Total Returns],datesytd('Calendar'[Date]), all(returns_table)) - calculate([Total Returns],datesytd('Calendar'[Date]))),
(calculate([Total Sales],datesytd('Calendar'[Date]), all(Sales_table)) - calculate([Total Sales],datesytd('Calendar'[Date])))
)

 

Really hoping someone can figure this one out as, I'm sad to say, this has me beat  

amitchandak
Super User
Super User

@DaveCor , Try like


divide(
calculate([Total Returns],datesytd('Calendar'[Date]), all(returns_table)) - calculate([Total Returns],datesytd('Calendar'[Date])),
calculate([Total Sales ],datesytd('Calendar'[Date]), all(Sales_table)) - calculate([Total Sales ],datesytd('Calendar'[Date]))
)

Hi @amitchandak , thank you, I appreciate you taking the time to look at this.

 

I tried your suggestion but I am getting no values when I add it to my table, just a blank column. 

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.