Forum Discussion
Count customers making a loss
- 6 years ago
Hi!
I hope this helps answer your question:
Measure =
COUNTX(
FILTER(
SUMMARIZE(
'Customer',
'Customer'[ID],
'Customer'[Name],
"Actual", SUM('Actuals'[Amount]),
"Forecast" , SUM('Forecasts'[Amount])
),
[Actual] > [Forecast]),
'Customer'[ID]
)Regards
- 6 years ago
Try this:
First create Sum measures for both Sales and Forecast:
Sum of sales = SUM(Sales[sales]) "Actuals" in your example
Sum of Forecast = SUM(Forecast[forecast]) "Forecasts" in your exampleand then:
Obvisously use your customer table instead of my "Sales Product" table. (Assuming your Customer table is linked in one-to-many with both your sales table and forecast table)
Thanks JasonTX This works perfectly! Now just trying to work out how it works, so I can reuse something similar next time! Cheers!
Not sure if you are familiar with SQL, but it is similair to this query (Asuming everything is in one table):
SELECT COUNT(ID) FROM
(SELECT ID , NAME, Sum(ActualAmount), Sum(ForecastAmount)
FROM TABLE
GROUP BY ID, NAME) a
- ansa_naz6 years ago
Continued Contributor
that makes perfect sense! so the SUMMARIZE is a subquery combined with a GROUPBY. Will have to use this more often now, cheers