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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
ErickTilieri
Regular Visitor

Calculated measure in Filter function not working

Hello,

 

I'm having trouble understanding why my filter expression is not working. The syntax bellow uses a calculated measure named LOST, as well as the subsequent measures that I'm using.

 
Number of lost clients = CALCULATE( distinctCOUNT(sales_data_sample[CUSTOMER_NAME]), filter(sales_data_sample,[Lost] = "lost"))
 
Lost = IF(sales_data_sample[inactive] = "inactive", "lost", if(sales_data_sample[AVG order per month] >= 0.33, "not lost", "lost"))
 
Inactive = if(datediff(LASTDATE(sales_data_sample[ORDER_DATE]),date(2005,05,31),DAY) > 180,"inactive", "active")
 
AVG order per month =
if(sales_data_sample[months stay] = 0, 0, distinctcount(sales_data_sample[ORDER_DATE])/sales_data_sample[months stay])
 
The following is a table visual where I use the measures above to tell if a client is considered lost or not.

dax problem.jpg

I have in total 92 unique costumer names in the dataset and I'm trying to count only the clients with the value "lost" in the column (calculated measure) Lost. But the formula keeps returning all 92 costumers. Can someboy help me understand what am doing wrong?

3 REPLIES 3
technolog
Super User
Super User

technolog
Super User
Super User

You need to create Lost like a calculated column in you case

Lost = IF(sales_data_sample[inactive] = "inactive", "lost", if(sales_data_sample[AVG order per month] >= 0.33, "not lost", "lost"))

Sorry, forgot to mention that the [inactive] measure was also a calculated measure and not a calculated column.
Same for AVG order per Month.
So since all those measures are not calcualted column, I don't think your suggestion would work.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.