Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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:
Raw Data:
| Vendor | Cod_Order | Vendor Cancelled |
| 105 | 2332 | 0 |
| 117 | 23211 | 1 |
| 116 | 321455 | 1 |
| 107 | 12311 | 0 |
| 104 | 2356 | 1 |
| 125 | 5632 | 0 |
| 114 | 9867 | 0 |
| 108 | 5421 | 0 |
Sample Expected output:
Aggregation per seller with a FLAG = 1 if the Vendor cancelled more than 5% of his own total orders
| Vendor | Vendor cancellations > 5 % |
| 105 | 1 |
| 100 | 0 |
| 107 | 0 |
SAMPLE Table:
Thank you
Diego
Solved! Go to Solution.
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
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
Hi @Anonymous
you can use
DIVIDE ( SUM, CALCULATE (SUM, ALSELECTED(Table[Vendor]))
then compare with IF >= 0.5
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 14 | |
| 7 | |
| 4 | |
| 4 | |
| 3 |
| User | Count |
|---|---|
| 25 | |
| 10 | |
| 10 | |
| 6 | |
| 6 |