Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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.
-----------------------
Solved! Go to Solution.
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.
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.
Hey daxer, thanks for the explanation!
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.
@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()))
User | Count |
---|---|
22 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
25 | |
12 | |
11 | |
7 | |
6 |