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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
BidyaSingha
Frequent Visitor

Show percentage of a number of items in a column compared with the total row count of table

Hello connection,

 

Below measure display the value of "dept1" only. We can write different measure for other department.
It is possible to write the single measure to get all different department  percentage, Is this achievable?

 

Below is the "dept1" measure. Instead of writing different measure for different department can we write in single measure?

BidyaSingha_0-1700223222260.png

Measure = 
VAR _A =
    CALCULATE(
        COUNTA( 'Table'[names] ),
        FILTER( ALL( 'Table' ), 'Table'[names] = "dept1" )
    )
VAR _B =
    CALCULATE( COUNTA( 'Table'[names] ), ALL( 'Table' ) )
RETURN
    _A / _B


Thank in advance.

1 ACCEPTED SOLUTION
sjoerdvn
Super User
Super User

Measure = IF (HASONEVALUE('Table'[names]),
    VAR cur_name = VALUES( 'Table'[names])
    RETURN DIVIDE(
        CALCULATE( COUNTA( 'Table'[names]), ALL( 'Table' ), 'Table'[names] = cur_name )
        ,CALCULATE( COUNTA( 'Table'[names]), ALL( 'Table' ))
    )
)

View solution in original post

3 REPLIES 3
tamerj1
Super User
Super User

Hi @BidyaSingha 
Please try

Measur =
VAR _A =
    COUNTROWS ( 'Table' )
VAR _B =
    CALCULATE ( COUNTROWS ( 'Table' ), ALL ( 'Table'[names] ) )
RETURN
    _A / _B
sjoerdvn
Super User
Super User

Measure = IF (HASONEVALUE('Table'[names]),
    VAR cur_name = VALUES( 'Table'[names])
    RETURN DIVIDE(
        CALCULATE( COUNTA( 'Table'[names]), ALL( 'Table' ), 'Table'[names] = cur_name )
        ,CALCULATE( COUNTA( 'Table'[names]), ALL( 'Table' ))
    )
)
Rupak_bi
Super User
Super User

try this

Measure = 
VAR _A =
    CALCULATE(
        COUNTA( 'Table'[names] ),
        FILTER( ALLexcept( 'Table' , 'Table'[names] ) )
    )
VAR _B =
    CALCULATE( COUNTA( 'Table'[names] ), ALL( 'Table' ) )
RETURN
    _A / _B


Regards
Rupak
FOLLOW ME : https://www.linkedin.com/in/rupaksar/

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.