Forum Discussion

albertax's avatar
albertax
Frequent Visitor
2 years ago

Return completed based upon CALCULATE(COUNTROWS)

Hi Team,

 

I am having a bit of a trouble with a Column inside my table. I want to return the number of completed values (which should be 2); instead i am getting a very long number that is duplicating across). 

 

COMP =
IF (
    [Role Type] = "SHEQ",
    CALCULATE (
        COUNTROWS ( 'SE' ) + 0,
        FILTER (
            'SE',
            'SE'[ModuleType] = "CCC"
        ),
        FILTER (
            'SE',
            OR (
                CONTAINSSTRING ( 'SE'[CompletedByName], 'Targets'[Name] ),
                CONTAINSSTRING ( 'SE'[CompletedByName], 'Targets'[Alias] )
            )
        ),
        FILTER ( 'Calendar', 'Calendar'[eom-date] = 'Targets'[Date] )
    )
)
 

 

 
Any ideas on what might be causing this?

2 Replies

  • albertax , seem like you are creating a new column. It means full table is available unless filtered

     

    better to have a measure like

     

    COMP =

    CALCULATE (
    COUNTROWS ( 'SE' ) + 0,
    FILTER (
    'SE',
    'SE'[ModuleType] = "CCC"
    ),
    FILTER (
    'SE',
    OR (
    CONTAINSSTRING ( 'SE'[CompletedByName], 'Targets'[Name] ),
    CONTAINSSTRING ( 'SE'[CompletedByName], 'Targets'[Alias] )
    ) && [Role Type] = "SHEQ"
    ),
    FILTER ( 'Calendar', 'Calendar'[eom-date] = max('Targets'[Date] ))
    )

     

    If this does not help
    Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.