Forum Discussion

powerbanana's avatar
powerbanana
Regular Visitor
4 years ago
Solved

Count YTD Sales above specific value

Hi all, 

Very new with Power BI and hope someone can help me.

 

I am trying to count the number of clients that have YTD sales above a certain threshold. I have the following two tables: 
First Table
Name: DATE

DateYearMonth Month NumberQuarter
01.07.20212021July7Q3
02.07.20212021July7Q3
...............


Second Table

Name: SalesData

Reporting PeriodClientNameSales
1 September 2021Apple10
1 September 2021Banana30
1 September 2021Orange50
1 October 2021Apple10
1 October 2021Banana15
1 October 2021Orange60
1 November 2021Apple15
1 November 2021Banana50
1 November 2021Orange60

 

Now, I have used the following measure to calcuate the YTD Sales, which a working fine:
Sales_Sum = SUM('SalesData'[Sales])
Sales_YTD = IF(Sales_Sum<>Blank(), Calculate([Sales_Sum], DATESYTD['Date'[Date])))

Finally, I am not able to get the correct count of clients above a threshold of 40 YTD Sales per month. The count are incorrect for the month of August (see screenshot below). I used the following measure: 
CountFilter_YTD = CALCULATE(Count('SalesData'[ClientName]), FILTER('SalesData', [Sales_YTD]>40)

 

 

Would greatly appreciate some guidance!

5 Replies