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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
kanebuddy
Regular Visitor

Measure for Column that displays percentage of blank fields

Hi Experts, 

I am looking for a calculation that would give me the percentage of blank fields based on another value.

here is an example.

This is how my data looks like

Column1Column2
123
145
2 
267
3 
3 
3 

 

so here we have no blanks in column2 for 1, 2 is half empty and for 3 is totally empty

The expected result is a table with one column as above and the calculated column showing the percentage of blanks:

 

column1calc_column
10%
250%
3100%

 

Thanks ks in advance for your help!

 

 

 

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @kanebuddy 

try to plot a table visual with the column1 and a measure like

 

Measure = 
VAR _countall =
COUNTROWS( TableName)
VAR _countblank =
COUNTROWS(
    FILTER(
        TableName,
        TableName[Column2]=BLANK()
    )
)
RETURN
DIVIDE(_countblank, _countall, 0)+0

 

 

it worked like:

FreemanZ_2-1675949491183.png

 

 

View solution in original post

4 REPLIES 4
FreemanZ
Super User
Super User

hi @kanebuddy 

try to plot a table visual with the column1 and a measure like

 

Measure = 
VAR _countall =
COUNTROWS( TableName)
VAR _countblank =
COUNTROWS(
    FILTER(
        TableName,
        TableName[Column2]=BLANK()
    )
)
RETURN
DIVIDE(_countblank, _countall, 0)+0

 

 

it worked like:

FreemanZ_2-1675949491183.png

 

 

Hi Freemanz,

thanks for the reply, however I get only 1 and 0 as result of the measure, that doesnt look like percentage values. Items that should have a 100% gets 0 and empty ones get 1 and an item that has one blank out of 11 gets a 0,26. Cant see whats wrong..

 

Stop, thanks for that, I was fooling myself. Setting the Measure to display as Percentage on the modeling Tab and then think again about the expected result brings me to the conclusion thats doing exactly what it should.

Thanks again for the very quick help!

hi  @kanebuddy 

you may also write a calcualted table like:

 

 

Table = 
ADDCOLUMNS(
    VALUES(TableName[Column1]),
    "Pct",
    CALCULATE(
        VAR _countall =COUNTROWS( TableName)
        VAR _countblank =
            COUNTROWS(
                FILTER(
                    TableName,
                    TableName[Column2]=BLANK()
                )
            )
        RETURN
        DIVIDE(_countblank, _countall, 0)+0
    )
)

 

 

 

it worked like:

FreemanZ_3-1675949542794.png

 

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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

Top Kudoed Authors