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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
richardlima
Frequent Visitor

Counting with restriction

I have a base with documents that have multiple occurrences that are listed line by line, as shown in the table below:

 

Document Occurrence

 

12345 left over

12345 missing

23456 (another occurrence)

 

I need to count, and bring, which are the documents that have a certain occurrence and do not have the other. For example: A document that has a leftover occurrence must also have a missing document, but this does not always occur (by mistake). I need to detect which documents have been released the leftover occurrence, but the missing one has not yet.

 

What kind of counting would I do?

1 ACCEPTED SOLUTION
PattemManohar
Community Champion
Community Champion

@richardlima  Please try this as a New Column to flag the missing occurrences of the documents.

 

Flag = 
VAR _Count= CALCULATE(COUNT(Test223Lkp[Occurrence]),FILTER(Test223Lkp,Test223Lkp[Document]=EARLIER(Test223Lkp[Document]) && Test223Lkp[Occurrence] <> EARLIER(Test223Lkp[Occurrence])))
RETURN IF(_Count>0,"Y","N")

image.png





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




View solution in original post

1 REPLY 1
PattemManohar
Community Champion
Community Champion

@richardlima  Please try this as a New Column to flag the missing occurrences of the documents.

 

Flag = 
VAR _Count= CALCULATE(COUNT(Test223Lkp[Occurrence]),FILTER(Test223Lkp,Test223Lkp[Document]=EARLIER(Test223Lkp[Document]) && Test223Lkp[Occurrence] <> EARLIER(Test223Lkp[Occurrence])))
RETURN IF(_Count>0,"Y","N")

image.png





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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