Forum Discussion

fael_66's avatar
fael_66
New Member
1 year ago
Solved

Help with a measure to count

Hi,

i have been trying to figure this out but no luck. 

this is sample data:

Date of updateTask
10/01/2024A
15/01/2024A
15/01/2024B
23/01/2024C
10/02/2024A
28/02/2024B
03/03/2024B
25/03/2024C
30/03/2024A
01/04/2024C
15/05/2024D
20/05/2024A

 

I want to create a card that shows the following results  from it (bold data) 

number of tasks that have been updated once only= 1 task (i,e corresponds to task D)

number of tasks that have been updated 2 or 3 times = 2 task (i,e corresponds to task B & C)

number of tasks that have been updated 4 or more times= 1 task (i,e corresponds to task A)

 

instead all i have achieved is counting how many time a task has been updated. (example task A updated 5 time) this is not what im looking for.

 

any help is greatly apprreciated.

Thanks

  • fael_66,

     

    Try these measures:

     

    Tasks updated once = 
    VAR vTable =
        ADDCOLUMNS (
            VALUES ( 'Table'[Task] ),
            "@Count", CALCULATE ( COUNTROWS ( 'Table' ) )
        )
    VAR vResult =
        COUNTROWS ( FILTER ( vTable, [@Count] = 1 ) )
    RETURN
        vResult
    Tasks updated 2 or 3 times = 
    VAR vTable =
        ADDCOLUMNS (
            VALUES ( 'Table'[Task] ),
            "@Count", CALCULATE ( COUNTROWS ( 'Table' ) )
        )
    VAR vResult =
        COUNTROWS ( FILTER ( vTable, [@Count] IN {2, 3} ) )
    RETURN
        vResult
    Tasks updated 4 or more times = 
    VAR vTable =
        ADDCOLUMNS (
            VALUES ( 'Table'[Task] ),
            "@Count", CALCULATE ( COUNTROWS ( 'Table' ) )
        )
    VAR vResult =
        COUNTROWS ( FILTER ( vTable, [@Count] >= 4 ) )
    RETURN
        vResult

     

     

3 Replies

  • fael_66,

     

    Try these measures:

     

    Tasks updated once = 
    VAR vTable =
        ADDCOLUMNS (
            VALUES ( 'Table'[Task] ),
            "@Count", CALCULATE ( COUNTROWS ( 'Table' ) )
        )
    VAR vResult =
        COUNTROWS ( FILTER ( vTable, [@Count] = 1 ) )
    RETURN
        vResult
    Tasks updated 2 or 3 times = 
    VAR vTable =
        ADDCOLUMNS (
            VALUES ( 'Table'[Task] ),
            "@Count", CALCULATE ( COUNTROWS ( 'Table' ) )
        )
    VAR vResult =
        COUNTROWS ( FILTER ( vTable, [@Count] IN {2, 3} ) )
    RETURN
        vResult
    Tasks updated 4 or more times = 
    VAR vTable =
        ADDCOLUMNS (
            VALUES ( 'Table'[Task] ),
            "@Count", CALCULATE ( COUNTROWS ( 'Table' ) )
        )
    VAR vResult =
        COUNTROWS ( FILTER ( vTable, [@Count] >= 4 ) )
    RETURN
        vResult