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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
j0woods
New Member

Inflation Calculation at Sub Category Level

I am needing to specify the "level of calculation" for an inflation formula in my dataset, and I have not found a good way to do so yet. See the tables below for a simplified model/calculation. In this model, I need the inflation calculation to compare this year average cost to last year average cost at the sub category level and calculate Inflation $ as (TY avg cost - LY avg cost) * TY Units. I then need the category inflation $ to be a sum of the subcategory Inflation $, rather than a recalculation at the category level.

 

The reason I need the calcuation to work this way is to eliminate the impact of mix changes in my inflation $. i.e. the result should be the $54.10 shown below, not the $25.78 as recalculated at the category level).

 

ItemSub CategoryCategoryTY Units TY Avg Cost LY Units LY Avg Cost   
11010010 $          10.505 $          10.00  
21010020 $          11.0015 $          10.75  
31010025 $            9.5030 $            9.50  
41010045 $          10.00    
510100  30 $            9.50  
62010015 $            2.0010 $            1.90  
72010035 $            2.5040 $            2.45  
82010040 $            1.7515 $            1.50  
92010050 $            3.00    
1020100  40 $            2.50  
         
 Sub CategoryCategoryTY Units TY Avg Cost LY Units LY Avg Cost AUR Change Inflation $ 
 10100100 $          10.1380 $            9.77 $           0.36 $        35.94
 20100140 $            2.41105 $            2.28 $           0.13 $        18.17
         
         
  CategoryTY Units TY Avg Cost LY Units LY Avg Cost AUR Change Inflation $ 
 Correct:100240 $            5.63185 $            5.52  $        54.10
 Incorrect:100240 $            5.63185 $            5.52 $           0.11 $        25.78

 

I am struggling to find a way to accomplish this in a measure. My most recent attempt is below, but this appears to be recalculating at the category level still (i.e. the category Inflation $ are not the sum of the sub-category Inflation $). I have a fact table with units and dollars by date, location, item as well as attribute tables for date and item. TY Avg Cost, LY Avg Cost and TY Units are all measures within my data model. LY columns are calculated using or EDATE(fact_date, -12).

 

Inflation $ =

VAR subcat_list =
CALCULATETABLE (
SUMMARIZE (
'Item Attribute',
'Item Attribute'[Sub Category],
"@TY Avg Cost", [TY Avg Cost],
"@LY Avg Cost", [LY Avg Cost],
"@TY Units", [TY Units],
"@inflation_calc",([TY Avg Cost]-[LY Avg Cost])*[TY Units]
) )

RETURN
if(NOT ( or (ISBLANK ( [LY Avg Cost] ), ISBLANK ( [TY Avg Cost] ) )),SUMX ( subcat_list, [@inflation_calc] ),BLANK())
 
Thanks in advance!
1 REPLY 1
littlemojopuppy
Community Champion
Community Champion

First, create a hierarchy of Category/Subcategory.

Then in the measure to define inflation, use ISINSCOPE() to determine which level of the hierarchy is being calculated.  Note: check hierarchies from lowest level first to highest level last.

Can you provide some raw data to work with?

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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