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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
mhrkhd
Regular Visitor

using calculate function and the criteria is a measure

Dear Team. 

i have the below example, with 5 columns (Name,Unit,Training,Group,Status)

Name  Unit   Training    Group        Status
A001    CS     course1    Group1      Attended
A001    CS     course2    Group1      Attended
A001    CS     course3    Group1      Attended
A001    CS     course4    Group1      Attended
A001    CS     course5    Group1      Attended
A001    CS     course6    Group1      Attended
B002     IT      course1   Group1
B002     IT      course2   Group1       Attended
B002     IT      course3   Group1       Attended
B002     IT      course4   Group1       Attended
B002     IT      course5   Group1       Attended
B002     IT      course6   Group1      Attended
C003     LE     course1   Group1
C003     LE     course2   Group1
C003     LE     course3   Group1
C003     LE     course4   Group1     Attended


we need to know total number of staff completed all training they should complete based on the above example the result should be

A001 100%
B002 83%
C003 25%


so the filnal result should be 1 staff completed 100%

 

how to create a measure to give me this output?

1 ACCEPTED SOLUTION

Hi @mhrkhd ,

Clear. Please try this:

100% Count = 
COUNTX (
    FILTER (
        SUMMARIZE (
            'Table',
            'Table'[Name],
            "completed%",
                DIVIDE (
                    CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Name] = MAX ( 'Table'[Name] ) ),
                    CALCULATE (
                        COUNTROWS ( 'Table' ),
                        'Table'[Name] = MAX ( 'Table'[Name] )
                            && 'Table'[Status] <> BLANK ()
                    )
                )
        ),
        [Completed%] = 1
    ),
    [completed%]
)

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

View solution in original post

5 REPLIES 5
serpiva64
Super User
Super User

Hi,

i think there is a much simplier way but it functions

Column = var filttable = ADDCOLUMNS(SUMMARIZE( 'Table','Table'[Name],"nr",COUNT('Table'[Training]),"nrended", COUNT('Table'[Training])- COUNTBLANK('Table'[Status])),"%",DIVIDE([nrended],[nr]))
return
LOOKUPVALUE(t[%],t[Name],'Table'[Name])

serpiva64_0-1665127711822.png

If this post is useful to help you to solve your issue consider giving the post a thumbs up 

 and accepting it as a solution !

thanks but what you mean by (t) in this 

LOOKUPVALUE(t[%],t[Name],'Table'[Name])

i tried to put t but it gives error

v-cgao-msft
Community Support
Community Support

Hi @mhrkhd ,

Please try:

Completed % = 
VAR _total = CALCULATE(COUNTROWS('Table'),'Table'[Name]=MAX('Table'[Name]))
VAR _complete = CALCULATE(COUNTROWS('Table'),'Table'[Name]=MAX('Table'[Name])&&'Table'[Status]<>BLANK())
RETURN
DIVIDE(_complete,_total)

vcgaomsft_0-1665126582774.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

thanks Gao but i need from the Table a Measure to tell me that there is one person completed 100%, how to create the measure from the one you created? do we have to change it or to create another measure based on this one.

Hi @mhrkhd ,

Clear. Please try this:

100% Count = 
COUNTX (
    FILTER (
        SUMMARIZE (
            'Table',
            'Table'[Name],
            "completed%",
                DIVIDE (
                    CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Name] = MAX ( 'Table'[Name] ) ),
                    CALCULATE (
                        COUNTROWS ( 'Table' ),
                        'Table'[Name] = MAX ( 'Table'[Name] )
                            && 'Table'[Status] <> BLANK ()
                    )
                )
        ),
        [Completed%] = 1
    ),
    [completed%]
)

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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