Forum Discussion
AleksandrG
Helper I
3 years agoDAX. Filtering the calculation through a parameter.
Guys, hello! Please help me to solve the following problem. I want to calculate the lost profit only for products whose profit is less than the specified value in the parameter. I created a meas...
- 3 years ago
here is the solution 🙂
VAR _table =FILTER (ADDCOLUMNS (Assortment4,"Persent", CALCULATE ( [% Profit], ALLSELECTED ( 'Calendar' ) ),"Profit", CALCULATE ( [Profit], ALLSELECTED ( 'Calendar' ) ),"SalesQty", CALCULATE ( [Sales Qty], ALLSELECTED ( 'Calendar' ) ),"SalesPerDay", CALCULATE ( [Sales Per Day], ALLSELECTED ( 'Calendar' ) )),[Persent] > '% Profit'[Meaning % Profit])RETURNSUMX (_table,IF ([Remainder] = 0,DIVIDE ( [Profit], [SalesQty], 0 ) * [SalesPerDay]))
amitchandak
Super User
3 years agoAleksandrG , to filter a measure you need to force a group by. or use measure in the visual level filter
example
suxm(filter(values(Table[Name]), [percent] < selectedvalue(whatif[value]) ), [Measure])