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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
splambo2
Regular Visitor

Percentage with COUNT measure excluding page filtering

My table shows each file's name and type like so, and there are no duplicates:
_____________________________
FileName          |    FileType
------------------------------
cloudimage            jpg
annualreport          pdf

monthlyreport       pdf
catvideo                 mp4

geodata                 json

My report has two visuals:
1) Horizontal bar chart showing how many files of each type are in the table.
2) Card showing a percentage.

 

EXPECTED RESULTS
When all the bars are selected, the card should show 100%
When I select the bar for PDF, the card should show 40%
When I select all bars except jpg, the card should show 80%

I successfully created this measure to count the occurence of each filetype (which are text data)

MeasureA = (COUNT('Table'[FileType]))
 

I have unsuccessfully tried creating a second measure to use for the card visual, such as:

percentageMeasure = [MeasureA]/COUNTROWS('Table')


I tried everything I could think of: DIVIDE, CALCULATE, ALL, REMOVEFILTERS, EXCEPTALL, COUNTROWS but I can't find how to ignore the page filtering and display the correct percentage in the card. I only get:
1) 100% all the time - because 2 pdf files / 2 pdf files = 1
2) Error message about 'paramater is not the correct type', expecting a number, expecting a string, or 'cannot be found or may not be used.'

 

How can I get this card to show the correct percentage?

1 ACCEPTED SOLUTION
gmsamborn
Super User
Super User

Hi @splambo2 

 

Would a measure like this help?

 

Pct = 
    DIVIDE(
        COUNT( 'Table'[FileName] ),
        CALCULATE(
            COUNT( 'Table'[FileName] ),
            ALL( 'Table' )
        )
    )

 

 

Let me know if you have any questions.

 

splambo2.pbix

 



Proud to be a Super User!

daxformatter.com makes life EASIER!

View solution in original post

2 REPLIES 2
splambo2
Regular Visitor

@gmsamborn You beat me to the answer by a minute 🙂 Thank you!
It also works with REMOVEFILTERS instead of ALL.

gmsamborn
Super User
Super User

Hi @splambo2 

 

Would a measure like this help?

 

Pct = 
    DIVIDE(
        COUNT( 'Table'[FileName] ),
        CALCULATE(
            COUNT( 'Table'[FileName] ),
            ALL( 'Table' )
        )
    )

 

 

Let me know if you have any questions.

 

splambo2.pbix

 



Proud to be a Super User!

daxformatter.com makes life EASIER!

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Solution Authors