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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
SelflearningBi
Helper III
Helper III

how to filter and calcuate %

ModelValueIn fullOn time
A1yesYes
B2yesNo
C3yesYes
C4noNo
D1yesNo

I would like to calcuate what % of value is both yes On Time and in full.
I do this but not correct:
VAR YesValue= 
calcuate(sum(table'value'),filter(and table, 'on time'= "yes" && 'in full' = "yes")
VAR TOTAL=
Sum(total vlaue)
Return  divide(yesvalue,total vlaue)

please correct me

1 ACCEPTED SOLUTION
v-yueyunzh-msft
Community Support
Community Support

Hi , @SelflearningBi 

Here are the steps you can refer to :

(1)My test data is the same as yours.

(2)We can create a measure:

& yes = DIVIDE( SUMX( FILTER( 'Sheet6' , 'Sheet6'[On time] ="Yes" && 'Sheet6'[In full]= "yes" ) , [Value]) ,  CALCULATE( SUM('Sheet6'[Value]) ,ALLSELECTED('Sheet6')))

(3)Then we can put this in the visual and we can meet your need:

vyueyunzhmsft_0-1664853574878.png

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

View solution in original post

2 REPLIES 2
v-yueyunzh-msft
Community Support
Community Support

Hi , @SelflearningBi 

Here are the steps you can refer to :

(1)My test data is the same as yours.

(2)We can create a measure:

& yes = DIVIDE( SUMX( FILTER( 'Sheet6' , 'Sheet6'[On time] ="Yes" && 'Sheet6'[In full]= "yes" ) , [Value]) ,  CALCULATE( SUM('Sheet6'[Value]) ,ALLSELECTED('Sheet6')))

(3)Then we can put this in the visual and we can meet your need:

vyueyunzhmsft_0-1664853574878.png

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

Anonymous
Not applicable

Hi, Please try this :

VAR YesValue= 
calcuate(count(table'value'),filter(and table, 'on time'= "yes" && 'in full' = "yes")
VAR TOTAL=
count(total vlaue)
Return  divide(yesvalue,total vlaue)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.