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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.