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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Multiple date filters in calculatetable

Hi,
I saw this code snippet in a wokrshop held by Jeffrey Wang. The snippet defines a measure to calculate the number of returning customers  by date, in a very standard data model with sales, products and customers.

 

-----------------------

# NEW customers =
VAR vCustomersThisPeriod= VALUES(Appended_actuals[CustomerID])
var vCurrentdate = MIN('Date'[Date])
var VCustomersPreviousPeriod = CALCULATETABLE(VALUES(Sales[CustomerID]),
FILTER(ALL('Date'[Date]),'Date'[Date]<vCurrentdate),ALL('Date'[Date]))

Return COUNTROWS(EXCEPT(vCustomersThisPeriod,VCustomersPreviousPeriod))
-----------------------
 
My question is , why is there a need for the second ALL('Date'[Date]) in VCustomersPreviousPeriod?
Doesn't the first filter already accomplish the task?
Thanks a lot for the answers.
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Good spot! This ALL(...) is not necessary. It serves no purpose, even though it's not harmful, either. The FILTER overwrites any filter present on the column anyway, so removing any filters via ALL is redundant.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Good spot! This ALL(...) is not necessary. It serves no purpose, even though it's not harmful, either. The FILTER overwrites any filter present on the column anyway, so removing any filters via ALL is redundant.

Anonymous
Not applicable

Hey daxer, thanks for the explanation!

 

Anonymous
Not applicable

Hi @amitchandak , thanks a lot for taking the time to answer, but I am not sure it responds to the question i had. In any case, it is much appreciated.

amitchandak
Super User
Super User

@Anonymous , I usually follow a measure approch

 

Current = sum(Table[Sales])

past =

Var _min = minx(allselected('Date'), Date[Date])

return

calculate(sum(Table[Sales]), filter(all('Date'), Date[Date] <_min)

 

 

new = countx(values(customer[Customer]), if(not(isblank([Current]))  && isblank([Past]) , [Customer], bank()))

 

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
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.