Reputation: 13
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"
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
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