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 August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Need help getting ID from a column ( can have multiple same ID) and outputting all their data

Hey guys i dont know how to explain this but i do need something like this:

IDSubmission recordOutput

Karl

SubmittedSubmitted
KarlSubmittedSubmitted
JohnNot SubmittedNot Submitted
JohnNot SubmittedNot Submitted
PeterSubmittedSubmitted
PeterNot in ScopeSubmitted

 

 

so first is group the name and get their submission record so for Karl he does have 2 "Submitted" and here comes the if statements which is

if Submission records are Not Submitted then [Output]=Not Submitted

if Submission record Not in Scope then [Output]=Not in Scope

if Submission records contains Not in Scope and Submitted then [Output]=Submitted

if Submission records contains Submitted and Not Submitted then [Output]= Submitted 

 

i can do the if statements but i dont know how to group them by [ID] and check their [Submission] base on [ID]

 

 

1 ACCEPTED SOLUTION
v-kelly-msft
Community Support
Community Support

Hi @Anonymous ,

 

Create a column as below:

Column =
VAR _count1 =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER ( 'Table', 'Table'[ID] = EARLIER ( 'Table'[ID] ) )
    )
VAR _countsubimtted =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER (
            'Table',
            'Table'[ID] = EARLIER ( 'Table'[ID] )
                && 'Table'[Submission record] = "Submitted"
        )
    )
VAR _countnotsub =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER (
            'Table',
            'Table'[ID] = EARLIER ( 'Table'[ID] )
                && 'Table'[Submission record] = "Not Submitted"
        )
    )
VAR _notinscope =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER (
            'Table',
            'Table'[ID] = EARLIER ( 'Table'[ID] )
                && 'Table'[Submission record] = "Not in Scope"
        )
    )
RETURN
    IF (
        _count1 = _countnotsub,
        "Not Submitted",
        IF ( _count1 = _notinscope, "Not in Scope", "Submitted" )
    )

Or  a measure as below:

Measure =
VAR _count1 =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER ( ALL ( 'Table' ), 'Table'[ID] = MAX ( 'Table'[ID] ) )
    )
VAR _countsubimtted =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[ID] = MAX ( 'Table'[ID] )
                && 'Table'[Submission record] = "Submitted"
        )
    )
VAR _countnotsub =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[ID] = MAX ( 'Table'[ID] )
                && 'Table'[Submission record] = "Not Submitted"
        )
    )
VAR _notinscope =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[ID] = MAX ( 'Table'[ID] )
                && 'Table'[Submission record] = "Not in Scope"
        )
    )
RETURN
    IF (
        _count1 = _countnotsub,
        "Not Submitted",
        IF ( _count1 = _notinscope, "Not in Scope", "Submitted" )
    )

And you will see:

vkellymsft_0-1630309335902.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

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

View solution in original post

2 REPLIES 2
v-kelly-msft
Community Support
Community Support

Hi @Anonymous ,

 

Create a column as below:

Column =
VAR _count1 =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER ( 'Table', 'Table'[ID] = EARLIER ( 'Table'[ID] ) )
    )
VAR _countsubimtted =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER (
            'Table',
            'Table'[ID] = EARLIER ( 'Table'[ID] )
                && 'Table'[Submission record] = "Submitted"
        )
    )
VAR _countnotsub =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER (
            'Table',
            'Table'[ID] = EARLIER ( 'Table'[ID] )
                && 'Table'[Submission record] = "Not Submitted"
        )
    )
VAR _notinscope =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER (
            'Table',
            'Table'[ID] = EARLIER ( 'Table'[ID] )
                && 'Table'[Submission record] = "Not in Scope"
        )
    )
RETURN
    IF (
        _count1 = _countnotsub,
        "Not Submitted",
        IF ( _count1 = _notinscope, "Not in Scope", "Submitted" )
    )

Or  a measure as below:

Measure =
VAR _count1 =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER ( ALL ( 'Table' ), 'Table'[ID] = MAX ( 'Table'[ID] ) )
    )
VAR _countsubimtted =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[ID] = MAX ( 'Table'[ID] )
                && 'Table'[Submission record] = "Submitted"
        )
    )
VAR _countnotsub =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[ID] = MAX ( 'Table'[ID] )
                && 'Table'[Submission record] = "Not Submitted"
        )
    )
VAR _notinscope =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[ID] = MAX ( 'Table'[ID] )
                && 'Table'[Submission record] = "Not in Scope"
        )
    )
RETURN
    IF (
        _count1 = _countnotsub,
        "Not Submitted",
        IF ( _count1 = _notinscope, "Not in Scope", "Submitted" )
    )

And you will see:

vkellymsft_0-1630309335902.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

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

Greg_Deckler
Community Champion
Community Champion

@Anonymous Maybe:

Measure =
  VAR __ID = MAX('Table'[ID])
  VAR __Table = SELECTCOLUMNS('Table',"Submission",[Submission])
RETURN
  SWITCH(TRUE(),
    "Submitted" IN __Table,"Submitted",
    "Not Submitted" IN __Table,"Not Submitted",
    "Not in Scope"
  )

 



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...

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors