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.
I have the following Excel file which is imported to Power BI and it tracks the status for each order made by a client:
Client Order Status Quantity
1 345 1 20
1 345 2 20
1 345 3 20
2 567 1 12
2 567 2 12
2 567 3 12
I want to calculate the quantity like below :
Client Order Status Quantity
1 345 1 20
1 345 2 20
1 345 3 20
1 567 1 12
1 567 2 12
1 567 3 12
Total 32
It is like summing the distinct quantity for each Order which is 20+12=32 for each Client
Solved! Go to Solution.
YourMeasure=
var CountAll = SUM('yourTable'[Quantity])
var CountUnique =CALCULATE(SUM('yourTable'[Quantity]), 'yourTable'[Status]=1)
return IF(HASONEVALUE('yourTable'[Quantity]), CountAll,CountUnique)
YourMeasure=
var CountAll = SUM('yourTable'[Quantity])
var CountUnique =CALCULATE(SUM('yourTable'[Quantity]), 'yourTable'[Status]=1)
return IF(HASONEVALUE('yourTable'[Quantity]), CountAll,CountUnique)
Worked like charm !
@AmiraBedh try this:
Measure = SUMX(VALUES('Table'[Order]), CALCULATE(MAX('Table'[Quantity])))
It doesn't give me the expected ouput
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 |
---|---|
113 | |
97 | |
85 | |
70 | |
61 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |