Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi,
I have a requirement to find if the client exists in current year but doesn't exist in previous year.
How do I achieve this?
Solved! Go to Solution.
Hi, @bml123
I simply simulated some data that would solve your problem in 2 ways.
20 and 30 are client ids that exist in this year and did not exist in the previous year.
Method 1:
Measure:
Measure =
Var N1=CALCULATE(COUNT('Table'[client id]),
FILTER(ALL('Table'),[client id]=SELECTEDVALUE('Table'[client id])&&YEAR([Date])=YEAR(TODAY())))
Var N2=CALCULATE(COUNT('Table'[client id]),
FILTER(ALL('Table'),[client id]=SELECTEDVALUE('Table'[client id])&&YEAR([Date])=YEAR(TODAY())-1))
return
IF(N1>0&&N2=BLANK(),1,0)
Method 2:
Table:
Table 2 =
Var table1=Filter(SUMMARIZE('Table','Table'[client id],'Table'[Date]),YEAR([Date])=YEAR(Today()))
Var table2=Filter(SUMMARIZE('Table','Table'[client id],'Table'[Date]),YEAR([Date])=YEAR(Today())-1)
return
Except(SUMMARIZE(table1,'Table'[client id]),SUMMARIZE(table2,'Table'[client id]))
Is there a way to output the results you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, It's working well for my need (put 1 as new client if purchase after more than 1 year). But the total appears 0 ! I still looking to put it as a number to have total and do a graph with it. Have some solution for it?
Hi, @bml123
I simply simulated some data that would solve your problem in 2 ways.
20 and 30 are client ids that exist in this year and did not exist in the previous year.
Method 1:
Measure:
Measure =
Var N1=CALCULATE(COUNT('Table'[client id]),
FILTER(ALL('Table'),[client id]=SELECTEDVALUE('Table'[client id])&&YEAR([Date])=YEAR(TODAY())))
Var N2=CALCULATE(COUNT('Table'[client id]),
FILTER(ALL('Table'),[client id]=SELECTEDVALUE('Table'[client id])&&YEAR([Date])=YEAR(TODAY())-1))
return
IF(N1>0&&N2=BLANK(),1,0)
Method 2:
Table:
Table 2 =
Var table1=Filter(SUMMARIZE('Table','Table'[client id],'Table'[Date]),YEAR([Date])=YEAR(Today()))
Var table2=Filter(SUMMARIZE('Table','Table'[client id],'Table'[Date]),YEAR([Date])=YEAR(Today())-1)
return
Except(SUMMARIZE(table1,'Table'[client id]),SUMMARIZE(table2,'Table'[client id]))
Is there a way to output the results you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @v-zhangti
Thanks for this. How do I achieve the same for any year selected rather than current year?
Read about the EXCEPT() DAX function.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
84 | |
75 | |
68 | |
41 | |
35 |
User | Count |
---|---|
102 | |
56 | |
52 | |
46 | |
40 |