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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
barakm
Frequent Visitor

count and list only the new added values from the previous week

I’m trying to solve the following:  

I have one excel table contains columns of values(ID) and startTime + endTime for every week

I would like to count and also list only the new added values from the previous week

For example: first 7 values from first week, then 9 values fron second week , then 10 values

ID

startTime

endTime

   

a

02-Jul-24

09-Jul-24

   

b

02-Jul-24

09-Jul-24

   

c

02-Jul-24

09-Jul-24

   

d

02-Jul-24

09-Jul-24

   

e

02-Jul-24

09-Jul-24

   

f

02-Jul-24

09-Jul-24

   

g

02-Jul-24

09-Jul-24

   

a

09-Jul-24

16-Jul-24

   

c

09-Jul-24

16-Jul-24

   

d

09-Jul-24

16-Jul-24

   

f

09-Jul-24

16-Jul-24

   

g

09-Jul-24

16-Jul-24

 

 

 

h

09-Jul-24

16-Jul-24

 

 

 

i

09-Jul-24

16-Jul-24

   

j

09-Jul-24

16-Jul-24

   

k

09-Jul-24

16-Jul-24

 count of new IDs from previous week should be 4list only the added new IDs should be h,I,j,k

a

16-Jul-24

23-Jul-24

   

b

16-Jul-24

23-Jul-24

   

c

16-Jul-24

23-Jul-24

   

d

16-Jul-24

23-Jul-24

   

e

16-Jul-24

23-Jul-24

   

g

16-Jul-24

23-Jul-24

 

 

 

h

16-Jul-24

23-Jul-24

   

i

16-Jul-24

23-Jul-24

   

j

16-Jul-24

23-Jul-24

   

k

16-Jul-24

23-Jul-24

 count of new IDs from previous week should be2list only the added new IDs should be  b,e

 

Is that achievable with DAX ?  

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@barakm Try these. PBIX is attached below signature.

Count New Measure = 
    VAR __CurrentWeek = MAX('Table'[startTime])
    VAR __Current = DISTINCT( 'Table'[ID] )
    VAR __Previous = DISTINCT( SELECTCOLUMNS( FILTER( ALL('Table'), [startTime] = __CurrentWeek - 7 ), "ID", [ID] ) )
    VAR __New = EXCEPT( __Current, __Previous)
    VAR __Result = COUNTROWS( __New )
RETURN
    __Result


List New Measure = 
    VAR __CurrentWeek = MAX('Table'[startTime])
    VAR __Current = DISTINCT( 'Table'[ID] )
    VAR __Previous = DISTINCT( SELECTCOLUMNS( FILTER( ALL('Table'), [startTime] = __CurrentWeek - 7 ), "ID", [ID] ) )
    VAR __New = EXCEPT( __Current, __Previous)
    VAR __Result = CONCATENATEX( __New, [ID], "," )
RETURN
    __Result


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

@barakm Try these. PBIX is attached below signature.

Count New Measure = 
    VAR __CurrentWeek = MAX('Table'[startTime])
    VAR __Current = DISTINCT( 'Table'[ID] )
    VAR __Previous = DISTINCT( SELECTCOLUMNS( FILTER( ALL('Table'), [startTime] = __CurrentWeek - 7 ), "ID", [ID] ) )
    VAR __New = EXCEPT( __Current, __Previous)
    VAR __Result = COUNTROWS( __New )
RETURN
    __Result


List New Measure = 
    VAR __CurrentWeek = MAX('Table'[startTime])
    VAR __Current = DISTINCT( 'Table'[ID] )
    VAR __Previous = DISTINCT( SELECTCOLUMNS( FILTER( ALL('Table'), [startTime] = __CurrentWeek - 7 ), "ID", [ID] ) )
    VAR __New = EXCEPT( __Current, __Previous)
    VAR __Result = CONCATENATEX( __New, [ID], "," )
RETURN
    __Result


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thank you Greg, I manage to copy the DAX code and numbers seems to be OK 😀.  as for the list of the value I I would like to see it in a table where I could choose with a slicer which week to show... for some reason I was not able to download your PBIX, maybe you can try send it my email ? barak.m7@gmail.com ... but overall I'm very happy with what you've sent till now, amazing ! of course I'll be happy to mark your post as a solution.   

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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