Forum Discussion
Static Previous weeks Counts
- 5 years ago
Hi, Anonymous
Please try the below.
Item count previous week =CALCULATE (DISTINCTCOUNT ( [ITEM Number] ),FILTER ('Table',WEEKNUM ( 'Table'[Close Date], 1 )= WEEKNUM ( TODAY (), 1 ) - 1))Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
Linkedin: linkedin.com/in/jihwankim1975/
Twitter: twitter.com/Jihwan_JHKIM
Thanks Kim, can we add additional filter conditions this tis like current year because in my data set I have five years of data so the calculation shared accumulating all the values relavence to that week from all the months but we are expecting latest year only.
Hi, Anonymous
Thank you for your message.
Please try something like the below, that one more condition is added.
Item count previous week =
VAR currentyear =
YEAR ( TODAY () )
RETURN
CALCULATE (
DISTINCTCOUNT ( [ITEM Number] ),
FILTER (
'Table',
WEEKNUM ( 'Table'[Close Date], 1 )
= WEEKNUM ( TODAY (), 1 ) - 1
&& YEAR ( 'Table'[Close Date] ) = currentyear
)
)
- Anonymous5 years agoNot applicable
It is working now, thanks for the help.
- Anonymous5 years agoNot applicable
I did tied that but it was retruning below error
A function 'FILTER' has been used in a True/False expression that is used as a table filter expression. This is not allowed.