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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
timgiefer
New Member

Count value in column measure

Hi everyone!

 

I'm new to Microsoft Power Bi but there is the thing I want to do:

 

I've got a column called "cutting" with 0 (machine isn't working) and 1 (machine is working).

I want to create a measure called "UT" where the amount of rows with "cutting" = 1 is divided by the total amount of columns in the table 'Tabelle1'. The DAX formula is the following:

 

UT = CALCULATE(COUNT('Tabelle1'[cutting])/COUNTROWS('Tabelle1'); 'Tabelle1'[cutting] = 1)

When I try to display the measure on my dashboard, the field is blank.

 

I have already looked at different forum posts similar to my problem, but nothing seems to work.

 

 

Can anyone help?

 

 

Thanks

 

 

Tim

 

 

 

1 ACCEPTED SOLUTION
v-sihou-msft
Employee
Employee

@timgiefer

 

You should specify the context into entire table in your calculation formula. 

 

UT =
CALCULATE (
    COUNT ( 'Tabelle1'[cutting] ),
    FILTER ( ALL ( 'Tabelle1' ), 'Tabelle1'[cutting] = 1 )
)
    / COUNTROWS ( 'Tabelle1' )

Regards,

View solution in original post

2 REPLIES 2
v-sihou-msft
Employee
Employee

@timgiefer

 

You should specify the context into entire table in your calculation formula. 

 

UT =
CALCULATE (
    COUNT ( 'Tabelle1'[cutting] ),
    FILTER ( ALL ( 'Tabelle1' ), 'Tabelle1'[cutting] = 1 )
)
    / COUNTROWS ( 'Tabelle1' )

Regards,

CahabaData
Memorable Member
Memorable Member

please clarify what is meant by: "...the total amount of columns in table.....

 

how many columns and what are their names - a small sampling of the data set would help

www.CahabaData.com

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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