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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.