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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
AFra
Helper III
Helper III

Calulate distinctcount of codes present in one list AND not in the other

Hi all, 

 

I have a list of elements for each month. Some of these elements are present in the past month AND this month, others are not. Some others change status. 

I'd like to create three measures : 

- distinctcount of NEW elements (are present this month but not the previous month)

- distinctcount of GONE elements (were present last month but aren't anymore this month)

- distinctcount of elements that changed status 

 

So that for this table : 

CODEStatusDate
abc1R101-02-21
abc2R101-02-21
abc3R201-02-21
abc4R201-02-21
abc5R301-02-21
abc6VL101-02-21
abc7VL101-02-21
abc8VL201-02-21
abc1R101-03-21
abc3R101-03-21
abc4R101-03-21
abc5R201-03-21
abc6VL101-03-21
abc8VL101-03-21
abc9VL201-03-21
abc10VL201-03-21
abc11R201-03-21
abc12R201-03-21

 

I would get : 

- 4 new elements

- 2 gone elements

- 3 elements that changed status

      - 1 from R2 to R1

      - 1 from R3 to R2

      - 1 from VL2 to VL1

 

I started with creating a column that concatenates the code and the status. I guess I have to use the CALCULATE, DISTINCTCOUNT and MAX(Date) fonctions, but I can't figure it right. 

 

Anyone? Thanks a lot! 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @AFra ,

 

The results of the three measures are shown in the figure below. There should be 4 elements that change the state, they are abc3, abc4, abc5, abc8.

31.png

 

You can check details from the attachment.

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @AFra ,

 

The results of the three measures are shown in the figure below. There should be 4 elements that change the state, they are abc3, abc4, abc5, abc8.

31.png

 

You can check details from the attachment.

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you so much! It's exactly what I needed : ) 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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