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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
MBreden
Helper I
Helper I

Calculations within categories

Hi all,

In my PBI table, values are calculated by category and retailer.

MBreden_0-1680700087224.png

Value = SUM('Data'[TradeTerm Value])
'Dim Retailer'[Retailer ID]
'Dim Category'[Main]

 

I would now like to calculate the sum, max, min, average and percentage from each category.

MBreden_1-1680700114827.png

Can someone please help me with the measures?

thanks a lot, Mel

5 REPLIES 5
FreemanZ
Super User
Super User

hi @MBreden 

not sure if i fully get you, you may try to plot a table visual with necessary columns and measures like:

Sum = 
SUMX( //replacing SUMX with MINX, MAXX, AVERAGEX for other measures
    FILTER(
        ALL(TableName),
        TableName[Categorie] = MAX(TableName[Categorie])
    ),
    TableName[Value]
)

TT% = 
DIVIDE(
    SUM(TableName[Value]),
    [Sum]
)

it worked like:

FreemanZ_0-1680703602907.png

 

Hi @FreemanZ ,

thanks for your reply, but I'm not getting a proper result yet.
Shouldn't the table 'Dim Retailer' also be taken into the measure

MBreden_0-1680706835071.png

 

 

hi @MBreden 

[Main] and measure [TT Value], what are they? How are they related with the columns in your original post?

Hi @FreemanZ,

I could not implement your 2nd suggestion at all.


My data model looks like this:

MBreden_0-1681209737317.png

For better understanding, I have created a shortened example file.

hi @MBreden 

if you mind the duplicates, try like:

Sum2 = 
VAR _table = 
FILTER(
    ALL(TableName),
    TableName[Categorie] = MAX(TableName[Categorie])
)
VAR _id =MAXX( _table,TableName[Retailer ID]
)
RETURN
IF(
    MAX(TableName[Retailer ID]) = _id, 
    SUMX( _table, TableName[Value]) //replacing SUMX with MINX, MAXX, AVERAGEX
)

it worked like:

FreemanZ_1-1680704094285.png

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.