Forum Discussion
Use a variable in a measure as a filter within same measure
Hi Zubair_Muhammad. I've added the second measure to reference the first. However, the results are simply adding up the total of all values and not just the total where the customer is underperforming to expectations.
Hello,
If I correct undrestud, you are tracking performance by Customer. Try this approach (in example I use dimension table Customer with attribute Customer Name):
Total Month Expected vs Actual =
SUMX (
ADDCOLUMNS (
VALUES ( Customer[Customer Name] ),
"UnderPerforming", CALCULATE (
[Month Expected] - [Month Actuals],
FILTER ( Table1, [Frequency] = "Only Once" ),
FILTER ( Table2, [Date] = Table3[Max Expected Date] )
)
),
IF ( [UnderPerforming] > 0, [UnderPerforming] )
)
- ChuckChuck8 years ago
Helper I
Thanks, popov. I've given this a try, but the resutls where only returned for one of the 15 customers and those results weren't correct. If I remove the SUMX part and just do the ADDCOLUMNS part, I get an error "The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value." Do you know what this indicates?
- popov8 years ago
Resolver III
Hello, ChuckChuck
Sorry for my delay. Can you share your formula (based my formula) and screenshots for current and expected result?- ChuckChuck8 years ago
Helper I
Hi popov, I made some test data and applied the measure to it and then created some screen grabs. This is close to what I need, but it is picking up the values for dates I'm not interested in and it's not giving me a total, just blank.