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 am trying to write DAX to calculate the sum of column Quantity where column Age equals value A or value B but not where it equals value C or value D.
I know how to calculate the sum for one value, but I can't figure out to calculate based on two values.
For one condition, I have:
Quantity | Age |
5 | DSP 0-63 |
5 | DSP 0-63 |
5 | DSP 64-126 |
5 | DSP 64-126 |
5 | DSP 127-200 |
5 | DSP 127-200 |
5 | DSP +200 |
5 | DSP +200 |
Solved! Go to Solution.
@Anonymous -
This seems to work:
Measure =
CALCULATE (
SUM ( 'Part 4'[Quantity] ),
FILTER (
'Part 4',
'Part 4'[Age] = "DSP 0-63"
|| 'Part 4'[Age] = "DSP 64-126"
)
)
Proud to be a Super User!
@Anonymous -
This seems to work:
Measure =
CALCULATE (
SUM ( 'Part 4'[Quantity] ),
FILTER (
'Part 4',
'Part 4'[Age] = "DSP 0-63"
|| 'Part 4'[Age] = "DSP 64-126"
)
)
Proud to be a Super User!
Thanks! This only gives me the total for DSP 0-63. I need the total for DSP 0-63 + DSP 64-126
@Anonymous -
I do not understand what you mean.
Proud to be a Super User!
Never mind. I did a hard refresh, and everything works. Thank you!
Marie
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 | |
99 | |
80 | |
70 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |