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

Get Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher now.

Reply
RainyClouds
New Member

Need help with DAX for percentage of filtered total with a twist

Hello all,

 

I'm trying to calculate a couple of measures in DAX using this dummy set of data from the table below (I cannot provide real data due to the nature of the project):

SalesPersonDatePaymentTypeLocationCategoryTransactionFlagAmount
Daisy11-JanCashMetroDongle010
Daisy11-JanCashRegionalWidget 15
Daisy11-JanCardMetroWidget1100
Daisy10-JanCashMetroWidget 12
Daisy10-JanCashRegionalWidget117
Daisy10-JanCardMetroDongle0120
Dean11-JanCashMetroDongle011
Dean11-JanCashRegionalWidget016
Dean11-JanCardMetroWidget0110
Dean10-JanCashMetroWidget013
Dean10-JanCashRegionalWidget018
Dean10-JanCardMetroDongle0130
Gillian11-JanCashMetroDongle09
Gillian11-JanCashRegionalWidget014
Gillian11-JanCardMetroWidget190
Gillian10-JanCashMetroWidget018
Gillian10-JanCashRegionalWidget019
Gillian10-JanCardMetroDongle080
Gibbo11-JanCashMetroDongle020
Gibbo11-JanCashRegionalWidget021
Gibbo11-JanCardMetroWidget 140
Gibbo10-JanCashMetroWidget030
Gibbo10-JanCashRegionalWidget08
Gibbo10-JanCardMetroDongle 105

*Note that in the table above, the TransactionFlag can have values of 1 (for true), 0 (for false), or blank (for not applicable).

 

The two measures are for Flagged Transaction Amount (those where TransactionFlag = 1) as a percentage of a SalesPerson's total Amounts; and then Flagged Transaction Amount as a percentage of all SalesPerson's total amounts who have a flagged transaction. I will also want to be able to slice the report by all dimensions. It is important that all of a SalesPerson's amounts are included in the total if and only if they have a flagged transaction in whatever slice has been selected.

 

So effectively I want to be able to get to a table like this:

SalesPerson  Date  PaymentType  Location  Category  Amount  Flagged Amount as a % of SalesPerson Total Amount  Flagged Amount as a % of All SalesPerson with FlaggedTransaction Total Amount  
Daisy11-JanCardMetroWidget10080.0042.02
Daisy10-JanCashRegionalWidget1711.4111.41
Gillian11-JanCardMetroWidget9079.65

37.82

 

 

And like this:

SalesPerson  PaymentType  Category  Amount  Flagged Amount as a % of SalesPerson Total Amount  Flagged Amount as a % of All SalesPerson with FlaggedTransaction Total Amount  
DaisyCardWidget11779.5943.66
GillianCardWidget9074.3833.58

 

Can anyone help me with the DAX for these measures? I'm not really even sure where to start. Thanks!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @RainyClouds,

 

You can use following measures to achieve your requirement, it will dynamic changes based on category fields:

% of SalePerson =
DIVIDE (
    SUM ( Sales[Amount] ),
    CALCULATE (
        SUM ( Sales[Amount] ),
        ALLSELECTED ( Sales ),
        VALUES ( Sales[SalesPerson] )
    ),
    -1
)

% of ALL SalePerson =
DIVIDE (
    SUM ( Sales[Amount] ),
    CALCULATE ( SUM ( Sales[Amount] ), ALLSELECTED ( Sales ) ),
    -1
)

 

Regards,

Xiaoxin Sheng

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @RainyClouds,

 

You can use following measures to achieve your requirement, it will dynamic changes based on category fields:

% of SalePerson =
DIVIDE (
    SUM ( Sales[Amount] ),
    CALCULATE (
        SUM ( Sales[Amount] ),
        ALLSELECTED ( Sales ),
        VALUES ( Sales[SalesPerson] )
    ),
    -1
)

% of ALL SalePerson =
DIVIDE (
    SUM ( Sales[Amount] ),
    CALCULATE ( SUM ( Sales[Amount] ), ALLSELECTED ( Sales ) ),
    -1
)

 

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.