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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Sum of an already existing average measure

Hi PowerBI community and hopefully I'll find an aswer here. 😊

 

My problem is that I have a simple AVERAGE(X) function because I'm using a table has been cross joined (a cartesian product). Now, when drilling down the smalledt granularity possible (eg. product code), I get a correct result, but when drill up to category, I get an average inside of that category, which is expected and logical behaviour.

 

Is it possible to make a derived measure out of the simple AVERAGE(X) measure that would sum whenever I "climb up" a dimension, eg. from product to category. I tried doing the following which is kind of what I am looking (I think):

  • SUMX(VALUE(Y), AVERAGE(X))

View below wold show seperate inputted forecasts for some dates for the same product:

k4p1z4n0s_2-1647555949422.png

 

 

On the other hand, view below should show "total" (SUM) of each category:

k4p1z4n0s_3-1647555965083.png

 

If any of resident DAX experts could help, I would be very grateful 🙂

 

Thank you!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi there,

 

sorry for the lack of reply, just now got to it. I have to say, this honestly look a bit too complicated for me, but I have figured out (at least I think so) what to do:

  • SUMX(VALUES(Y), CALCULATE(MAX(X))

This seems to work for now, I'll report back if there any unwanted occurences.

 

Thank you again!

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi there,

 

sorry for the lack of reply, just now got to it. I have to say, this honestly look a bit too complicated for me, but I have figured out (at least I think so) what to do:

  • SUMX(VALUES(Y), CALCULATE(MAX(X))

This seems to work for now, I'll report back if there any unwanted occurences.

 

Thank you again!

That's great. If it is a solution can you please mark it as solved?

Have a good week ahead!

Whitewater100
Solution Sage
Solution Sage

Hi:

The INSCOPE function works well for your question.  I'm not sure if you have subcat, but you can start with this approach. This should reveal the category % of total and thenhow the products reporting to this category contribute to their category. I hope it helps you. 

 

SalesPct =
VAR AllSales =
CALCULATE ( [Total Sales], ALLSELECTED () )
VAR CategorySales =
CALCULATE ( [Total Sales], ALLSELECTED (), VALUES ( Products[Brand] ) )
VAR CurrentSales = [Total Sales]
RETURN
SWITCH (
TRUE (),
ISINSCOPE ( Products[Product] ), DIVIDE ( CurrentSales, CategorySales ),
ISINSCOPE ( 'Products'[Category] ), DIVIDE ( CurrentSales, AllSales )
)
 
The other more basic share one can be:

DIVIDE([Sales Amount],

CALCULATE([Sales Amount], REMOVEFILTERS(Products[Category])))

                          or               ,REMOVEFILTERS())

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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