Omar
Omar

Reputation: 13

Power BI if column equals this and greater than that then Percentage

I am trying to do an if statement in a Power Bi Measure.

See data below. If [Type] = "CD" && [Days] >= 5 then divide by the total number of "CD"

enter image description here

enter image description here

So the answer should be there are 7 CD and 2 are greater than or equal to 6 so that would be %85

Upvotes: 1

Views: 2628

Answers (1)

Strawberryshrub
Strawberryshrub

Reputation: 3389

The total number of CD would be

Total Number of CD = CALCULATE(COUNT('Table'[Type]); FILTER('Table'; 'Table'[Type] = "CD"))

The number of CD >= 5 are:

Total Number of CD greater 5 = CALCULATE(COUNT('Table'[Type]); FILTER('Table'; 'Table'[Type] = "CD" && 'Table'[Days] >= 5))

The percentage then would be:

Percentage = [Total Number of CD greater 5] / [Total Number of CD]

Upvotes: 1

Related Questions