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

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

Reply
Anonymous
Not applicable

Sum a calculation made on each line

HEllo everyone,

 

I have a simple problem I can't seem to figure out on my own.

I have a table of clients, with a column indicating the date of first purchase for a specific product line.

I have a date filter.

I want when i change the date filter, to evaluate on each line if the first purchase was in the time range selected in the filter, if so count 1 for that line, and sum the 1 to get a count of clients who made a purchase in that time range.

 

In SQL I would do that:

SUM(CASE WHEN date_first_purchase BETWEEN first_date AND last_date THEN 1 ELSE 0 END)

 

Is there a way to do that in DAX?

 

Thanks a lot!

3 REPLIES 3
Anonymous
Not applicable
Anonymous
Not applicable

I reread the documentation and achieved the desired results with a SUMX and CALCULATE with a little tweaking. Thanks anyway!

nandukrishnavs
Community Champion
Community Champion

@Anonymous 

 

Can you share the sample data so that we can validate the logic?

 


Regards,
Nandu Krishna

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.