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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
WorkHard
Helper V
Helper V

Compare a list of events from 2 different dates and find the ones that existed or not in both

I have a list of events. Once a week, I backup the list and I merge all previous backups in the same list.

I end up with a master list that contains the entire list of events including previous backups.

 

I'd like to compare the latest backup with the previous backup and see:

  • which events exist in both backups;
  • which events exist only in the previous backup
  • which events exist only in the current (latest) backup.

 

WorkHard_1-1619754644196.png

 

Is it possible to create a calculated column using DAX to achieve the result? A measure could potentially work but I can't use the measure in slicers or filters.

1 ACCEPTED SOLUTION

Hi, @WorkHard 

Thank you for your feedback.

Please check the below measure that is for creating a column.

 

Presence Column =
VAR currentweeknumber =
WEEKNUM ( TODAY (), 1 )
VAR currentweekevent =
CALCULATETABLE (
values( Events[EventID] ),
FILTER ( ALL ( Events ), WEEKNUM(Events[Date]) = currentweeknumber )
)
VAR previousevent =
CALCULATETABLE (
values( Events[EventID] ),
FILTER ( ALL ( Events ), WEEKNUM(Events[Date]) < currentweeknumber )
)
VAR latestonlylist =
EXCEPT ( currentweekevent, previousevent )
VAR bothlist =
INTERSECT ( currentweekevent, previousevent )
VAR previousonlylist =
EXCEPT ( previousevent, currentweekevent )
VAR currentevent =
Events[EventID]
RETURN
SWITCH (
TRUE (),
currentevent IN bothlist, "Both", // this argument has to be the first otherwise the result will not be correct
currentevent IN latestonlylist, "Latest Only",
currentevent IN previousonlylist, "Previous Only",
"Check again"
)
 

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

Picture4.png

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

5 REPLIES 5
Jihwan_Kim
Super User
Super User

Hi, @WorkHard 

 

I tried to create a sample pbix file based on your explanation.

Please check the below picture and the sample pbix file's link down below, whether it suits your case.

 

Picture2.png

 

Presence =
VAR currentweeknumber =
WEEKNUM ( TODAY (), 1 )
VAR currentweekevent =
CALCULATETABLE (
VALUES ( Events[EventID] ),
FILTER ( ALL ( Dates ), Dates[Week of Year] = currentweeknumber )
)
VAR previousevent =
CALCULATETABLE (
VALUES ( Events[EventID] ),
FILTER ( ALL ( Dates ), Dates[Week of Year] < currentweeknumber )
)
VAR latestonlylist =
EXCEPT ( currentweekevent, previousevent )
VAR bothlist =
INTERSECT ( currentweekevent, previousevent )
VAR previousonlylist =
EXCEPT ( previousevent, currentweekevent )
VAR currentevent =
MAX ( Events[EventID] )
RETURN
SWITCH (
TRUE (),
currentevent IN bothlist, "Both", // this argument has to be the first otherwise the result will not be correct
currentevent IN latestonlylist, "Latest Only",
currentevent IN previousonlylist, "Previous Only",
"Check again"
)
 
 

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

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Thanks @Jihwan_Kim ,

 

What would it take to turn this into a calculated column? 
I'm trying to use this measure as a chart legend but because it's a measure I can't add it to the legend or a slicer.

Hi, @WorkHard 

Thank you for your feedback.

Please check the below measure that is for creating a column.

 

Presence Column =
VAR currentweeknumber =
WEEKNUM ( TODAY (), 1 )
VAR currentweekevent =
CALCULATETABLE (
values( Events[EventID] ),
FILTER ( ALL ( Events ), WEEKNUM(Events[Date]) = currentweeknumber )
)
VAR previousevent =
CALCULATETABLE (
values( Events[EventID] ),
FILTER ( ALL ( Events ), WEEKNUM(Events[Date]) < currentweeknumber )
)
VAR latestonlylist =
EXCEPT ( currentweekevent, previousevent )
VAR bothlist =
INTERSECT ( currentweekevent, previousevent )
VAR previousonlylist =
EXCEPT ( previousevent, currentweekevent )
VAR currentevent =
Events[EventID]
RETURN
SWITCH (
TRUE (),
currentevent IN bothlist, "Both", // this argument has to be the first otherwise the result will not be correct
currentevent IN latestonlylist, "Latest Only",
currentevent IN previousonlylist, "Previous Only",
"Check again"
)
 

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

Picture4.png

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Ah. That's simple.

 

I see one more issue. I just want to compare the results from this week vs last week.

So I added currentweeknumber-1:

 

 

VAR previousevent =
CALCULATETABLE (
values( Events[EventID] ),
FILTER ( ALL ( Events ), WEEKNUM(Events[Date]) = currentweeknumber-1 )
)

 

 

 

But, for some reason. Event 62 from April 13 and Event 63 from April 14 still show up as "Previous Only" when they are actually more than 2 weeks ago.
Any reason why they show up like that instead of "Check again"?

 

WorkHard_0-1619761625296.png

 

 

Hi @WorkHard 

Thank you for your feedback.

I think the reason is that event 62 and 63 is also in 18th and 19th.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors