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
Anonymous
Not applicable

calculate count values and percentage of count in one measure

I have a data like this..

 

.Capture1.PNG

Report is created on matrix visual like this...

Capture2.PNG

Here i used a calcualtion for count values is 

countvalue = CALCULATE(DISTINCTCOUNT('Sheet1'[Policy]),'Sheet1'[ENDORSEMENT]=0 )
I need same calcualtion for count value with small changes ...The change is if category is Perecnatge of total then  calcualte percenatge values for count ...Ie..with in one column i want count calcualtion plus percenatge showing values...eg...
Capture3.PNG
plse help...

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

You can create a measure as below:

countvalue = 
VAR _count =
    CALCULATE ( DISTINCTCOUNT ( 'Sheet1'[Policy] ), 'Sheet1'[ENDORSEMENT] = 0 )
VAR _percentage =
    DIVIDE (
        _count,
        CALCULATE (
            DISTINCTCOUNT ( 'Sheet1'[Policy] ),
            FILTER (
                ALLSELECTED ( 'Sheet1' ),
                'Sheet1'[Category] = SELECTEDVALUE ( 'Sheet1'[Category] )
                    && 'Sheet1'[ENDORSEMENT] = 0
            )
        ),
        0
    )
RETURN
    IF (
        SELECTEDVALUE ( 'Sheet1'[Category] ) = "Percentage of Total",
        FORMAT ( _percentage, "0%" ),
        _count
    )

yingyinr_0-1620368361264.png

Best Regards

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Anonymous ,

You can create a measure as below:

countvalue = 
VAR _count =
    CALCULATE ( DISTINCTCOUNT ( 'Sheet1'[Policy] ), 'Sheet1'[ENDORSEMENT] = 0 )
VAR _percentage =
    DIVIDE (
        _count,
        CALCULATE (
            DISTINCTCOUNT ( 'Sheet1'[Policy] ),
            FILTER (
                ALLSELECTED ( 'Sheet1' ),
                'Sheet1'[Category] = SELECTEDVALUE ( 'Sheet1'[Category] )
                    && 'Sheet1'[ENDORSEMENT] = 0
            )
        ),
        0
    )
RETURN
    IF (
        SELECTEDVALUE ( 'Sheet1'[Category] ) = "Percentage of Total",
        FORMAT ( _percentage, "0%" ),
        _count
    )

yingyinr_0-1620368361264.png

Best Regards

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Solution Authors