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.
Hello!
I have the following meassure that @AlexisOlson helped me built:
It sums the sales of the End Users ( 'DB'[End User]) that sold <25000 within a Quarter, Product Group and Country WHEN 'DB'[STOCK]="NOT STOCK" and when 'DB'[Stock]<>"Not Stock", it calculates the total sales (even sales >25000)
CALCULATE (
[Sales],
FILTER (
'DB',
'DB'[Stock] <> "Not Stock" ||
CALCULATE (
[Sales],
ALLEXCEPT (
'DB',
'DB'[Year],
'DB'[Quarter],
'DB'[Product Group],
'DB'[Country],
'DB'[Stock],
'DB'[End User]
)
) < 25000
)
)
Now I want to see the sales <25.000 AND >10.000
The problem is that with the following meassure, it would only display the sales of 'DB'[Stock] <> "Not Stock"
Here is my meassure that does't work...
Small Sales =
VAR SmallSales =
CALCULATE (
[SO Net],
ALLEXCEPT (
'DB',
'DB'[Year],
'DB'[Quarter],
'DB'[Product Group],
'DB'[Country],
'DB'[Stock],
'DB'[End User]
)
)
RETURN
CALCULATE (
[SO Net],
FILTER (
'DB',
'DB'[Stock] <> "Not Stock"
|| SmallSales < 25000
&& SmallSales > 10000
)
)
Can someone please help me and explain why it does't work?
Solved! Go to Solution.
Not quite sure on the background but as a direct translation of what I can see I wondered if this would work:
Small Sales =
CALCULATE (
[SO Net],
FILTER (
'DB',
VAR SmallSales =
CALCULATE (
[SO Net],
ALLEXCEPT (
'DB',
'DB'[Year],
'DB'[Quarter],
'DB'[Product Group],
'DB'[Country],
'DB'[Stock],
'DB'[End User]
)
)
RETURN
'DB'[Stock] <> "Not Stock"
|| (SmallSales < 25000
&& SmallSales > 10000)
)
)
It's not working because once you create SmallSales variable it is fixed. Your filter then iterates through table DB but compares a constant on each row.
Do you actually want to evaluate [S0 Net] in the row context of each row in DB?
Not quite sure on the background but as a direct translation of what I can see I wondered if this would work:
Small Sales =
CALCULATE (
[SO Net],
FILTER (
'DB',
VAR SmallSales =
CALCULATE (
[SO Net],
ALLEXCEPT (
'DB',
'DB'[Year],
'DB'[Quarter],
'DB'[Product Group],
'DB'[Country],
'DB'[Stock],
'DB'[End User]
)
)
RETURN
'DB'[Stock] <> "Not Stock"
|| (SmallSales < 25000
&& SmallSales > 10000)
)
)
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 |
---|---|
114 | |
101 | |
78 | |
75 | |
49 |
User | Count |
---|---|
145 | |
108 | |
107 | |
89 | |
61 |