Forum Discussion
How to apply a measure calculation before roll up
- 4 years ago
Add an iterator at whatever the appropriate level of granularity is.
Assuming Sales Rep the granularity you want, try this:
Less 20% Margin = SUMX ( VALUES ( 'dim'[Sales Rep] ), IF ( [Margin] < .2, CALCULATE ( SUM ( 'Fact'[Selling] ) ), 0 ) ) - 4 years ago
This measure is designed to add up the values for each Sales Rep separately so it shouldn't be used when you don't want to do that.
I'm not sure, but I'm guessing you want something more like this:
Less 20% Margin 2 = CALCULATE ( [Margin], FILTER ( VALUES ( 'dim'[Sales Rep] ), [Margin] < .2 ) )
Add an iterator at whatever the appropriate level of granularity is.
Assuming Sales Rep the granularity you want, try this:
Less 20% Margin =
SUMX (
VALUES ( 'dim'[Sales Rep] ),
IF (
[Margin] < .2,
CALCULATE ( SUM ( 'Fact'[Selling] ) ),
0
)
)Thank you that works!!
I further changed the DAX to calculate margins of the sales reps <.2 and it works however the sub total row aggregates the percentages. Is there anyway to handle this please?
Thanks
- AlexisOlson4 years ago
Super User
This measure is designed to add up the values for each Sales Rep separately so it shouldn't be used when you don't want to do that.
I'm not sure, but I'm guessing you want something more like this:
Less 20% Margin 2 = CALCULATE ( [Margin], FILTER ( VALUES ( 'dim'[Sales Rep] ), [Margin] < .2 ) )