Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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 @carlovsky
you can use
DIVIDE ( SUM, CALCULATE (SUM, ALSELECTED(Table[Vendor]))
then compare with IF >= 0.5
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
47 | |
26 | |
19 | |
14 | |
10 |
User | Count |
---|---|
57 | |
49 | |
44 | |
18 | |
18 |