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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Percentage from the grand total by each seller | DAX

Hi all,

I'm looking for a DAX measure that gives me 1 if the vendor cancelled more than 5% of the orders from their own grand total

Can you please help? I have no idea on how to do it

 

SAMPLE Table:

Sample 

 

Raw Data:

VendorCod_OrderVendor Cancelled
10523320
117232111
1163214551
107123110
10423561
12556320
11498670
10854210

 

Sample Expected output:

Aggregation per seller with a FLAG = 1 if the Vendor cancelled more than 5% of his own total orders

 

VendorVendor cancellations > 5 %
1051
1000
1070

 

SAMPLE Table:

Sample 

 

 

Thank you

Diego

1 ACCEPTED SOLUTION
Jos_Woolley
Solution Sage
Solution Sage

Hi,

 

MyFlag :=
VAR MyThreshold = 0.05
VAR Orders =
    COUNTROWS( Data )
VAR Cancelled =
    CALCULATE(
        COUNTROWS( Data ),
        Data[Vendor Cancelled] = 1
    )
VAR ProportionCancelled =
    DIVIDE(
        Cancelled,
        Orders
    )
VAR ToFlag = 0 + ( ProportionCancelled > MyThreshold )
RETURN
    ToFlag

 

Regards

View solution in original post

2 REPLIES 2
Jos_Woolley
Solution Sage
Solution Sage

Hi,

 

MyFlag :=
VAR MyThreshold = 0.05
VAR Orders =
    COUNTROWS( Data )
VAR Cancelled =
    CALCULATE(
        COUNTROWS( Data ),
        Data[Vendor Cancelled] = 1
    )
VAR ProportionCancelled =
    DIVIDE(
        Cancelled,
        Orders
    )
VAR ToFlag = 0 + ( ProportionCancelled > MyThreshold )
RETURN
    ToFlag

 

Regards

tamerj1
Super User
Super User

Hi @Anonymous 

you can use 

DIVIDE ( SUM, CALCULATE (SUM, ALSELECTED(Table[Vendor]))

then compare with IF >= 0.5

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.