Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Morrison
Helper I
Helper I

Dax measure Count with filter

Hello,

I would like to count the number of stores with YTD YOY sales <0. I have created the following measure but the result is not correct. Can you help me correct it please. As a reference date, I entered the date of 04 09 2022 in the filters.

 

Number of Store in L = calculate(DISTINCTCOUNT('Table Sales'[Store Key]), FILTER('Table Sales',[Sales Net Amount YTD YoY] < 0))

 

StoreSales Net Amount YTDSales Net Amount Y-1 YTDSales Net Amount YTD YoYCount Store in Lose
A€ 1.110€ 1.037€ 731
B€ 1.998€ 1.976€ 22 
C€ 656€ 671-€ 15 
D€ 799€ 795€ 4 
E€ 523€ 518€ 6 
F€ 488€ 457€ 30 
G€ 714€ 827-€ 113 
H€ 292€ 262€ 30 
I€ 478€ 442€ 37 
1 ACCEPTED SOLUTION
m3tr01d
Continued Contributor
Continued Contributor

Hi @Morrison ,

the issue is with your Filter statement. Instead of iterating over Sales, it should be iterating over distinct values of Store key.

Maybe you can try this version instead?

Number of Store in L = 
COUNTROWS( 
	FILTER(
		VALUES('Table Sales'[Store Key]),
		[Sales Net Amount YTD YoY] < 0
	)
)



View solution in original post

2 REPLIES 2
m3tr01d
Continued Contributor
Continued Contributor

Hi @Morrison ,

the issue is with your Filter statement. Instead of iterating over Sales, it should be iterating over distinct values of Store key.

Maybe you can try this version instead?

Number of Store in L = 
COUNTROWS( 
	FILTER(
		VALUES('Table Sales'[Store Key]),
		[Sales Net Amount YTD YoY] < 0
	)
)



Hi m3tr01d,

thx for the solution 🙂

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.