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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
GB74
Regular Visitor

Can you add an AND to existing formula?

I created the following formula and it is working correctly:

 

Open Lines due previous months = Calculate(sum('Open Sales Orders'[SO Remaining Amount]),filter('Open Sales Orders','Open Sales Orders'[Shipping Date]<MIN('Date'[StartCurrentMonth])))
 
I now want to do the same for the current month (and then for next month, +2 months, +3 months & >3months).
I assumed that I could just add an AND to allow it to filter for >StartCurrent Month and <StartNextMonth like this:
 

Open Lines due this month = Calculate(sum('Open Sales Orders'[SO Remaining Amount]),filter('Open Sales Orders',AND('Open Sales Orders'[Shipping Date]>MIN('Date'[StartCurrentMonth]),'Open Sales Orders'[Shipping Date]<MIN('Date'[StartNextMonth]))))

 

but it returns no data.

Hoping someone might have a suggestion for me.

Thanks.

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@GB74 , Try like

 

//based on selecteddate or or today
Open Lines due previous months =
var _max = maxx(allselected('Date'), 'Date'[Date]) //or//Today()
return
Calculate(sum('Open Sales Orders'[SO Remaining Amount]),filter('Open Sales Orders','Open Sales Orders'[Shipping Date]<eomonth(_max,-1) +1))

 


//based on selecteddate or or today
Open Lines due 2nd previous months =
var _max = maxx(allselected('Date'), 'Date'[Date]) //or//Today()
return
Calculate(sum('Open Sales Orders'[SO Remaining Amount]),filter('Open Sales Orders','Open Sales Orders'[Shipping Date]<eomonth(_max,-2) +1))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

4 REPLIES 4
GB74
Regular Visitor

Thank you so much @amitchandak.

GB74
Regular Visitor

Thanks amitchandak.
That works perfectly for previous month.

I could also replace -1 near the end of the formula with 0 to calculate the value for this month.

However, if I then change it to +1 (or just 1), the value displayed is far too large. I feel that it is suddenly adding all future amounts, not just those due next month.
I hope I've explained that well.

@GB74 ,

Just due next month 

//based on selecteddate or or today
Open Lines due previous months =
var _max = maxx(allselected('Date'), 'Date'[Date]) //or//Today()
return
Calculate(sum('Open Sales Orders'[SO Remaining Amount]),filter('Open Sales Orders', eomonth('Open Sales Orders'[Shipping Date],0) = eomonth(_max,1) +1))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
amitchandak
Super User
Super User

@GB74 , Try like

 

//based on selecteddate or or today
Open Lines due previous months =
var _max = maxx(allselected('Date'), 'Date'[Date]) //or//Today()
return
Calculate(sum('Open Sales Orders'[SO Remaining Amount]),filter('Open Sales Orders','Open Sales Orders'[Shipping Date]<eomonth(_max,-1) +1))

 


//based on selecteddate or or today
Open Lines due 2nd previous months =
var _max = maxx(allselected('Date'), 'Date'[Date]) //or//Today()
return
Calculate(sum('Open Sales Orders'[SO Remaining Amount]),filter('Open Sales Orders','Open Sales Orders'[Shipping Date]<eomonth(_max,-2) +1))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors