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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Calculating based on a condition

Hello All,

    I have a table on whick I want to create a calculated column. The table looks like below:-

p1.PNG

The calculated column's calculation is:- sum(AllThatHave'1')/Count(AllThatAreNonEmpty). 

Considering the above data it is :- 11/12 = 0.916667

If we convert it to percentage we get 91.67%

I know the calculation but I am struggling to write a DAX formula for this. Please can anyone help me to write an appropriate DAX formula for the above calculation.

 

Thank You in Advance!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi MedhaTrivedi,

 

You can do it by unpivot your columns into Rows and calculate 1s and blanks in Power BI.

Go to your edi queries and unpivot all the columns into Rows. Your resultset should be like,

 

CityActivityValue
ACol1 
BCol11
ACol21
BCol2 
ACol3 
BCol3 
ACol41
BCol41
ACol51
BCol51
ACol61
BCol61
ACol71
BCol7 

 

Then easily find out how many 1s and blanks from the value column.

=DIVIDE(Sum(Table[Value]), CALCULATE(Count(Table[Value]), FILTER(Table, Table[Value] <> 1))

 

Hope this information helps you a lot.

 

Regards,

Pradeep

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi MedhaTrivedi,

 

You can do it by unpivot your columns into Rows and calculate 1s and blanks in Power BI.

Go to your edi queries and unpivot all the columns into Rows. Your resultset should be like,

 

CityActivityValue
ACol1 
BCol11
ACol21
BCol2 
ACol3 
BCol3 
ACol41
BCol41
ACol51
BCol51
ACol61
BCol61
ACol71
BCol7 

 

Then easily find out how many 1s and blanks from the value column.

=DIVIDE(Sum(Table[Value]), CALCULATE(Count(Table[Value]), FILTER(Table, Table[Value] <> 1))

 

Hope this information helps you a lot.

 

Regards,

Pradeep

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors