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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
aliasadivet
Frequent Visitor

Counting some of fields in a row of a table and excluding the empty fields

Hello everyone,

 

I have a table which has 15 columns. 7 columns have data that I need to do calculation on them. I need to find the percentage of filled fields in those 7 fields. for example, let's say in row 1 of the table 3 of 7 columns are filled out so I will have (3/7)*100 = 42.86%

I need to have this percentage for each row and add a column to my table to display the persentage. Please assist me.

 

Thanks.

3 REPLIES 3
littlemojopuppy
Community Champion
Community Champion

@aliasadivet to start with, your data model could probably be improved.  Instead of having seven columns of data, maybe header fields coupled with Field, Value.  Made up data to illustrate the point...

 Header1   Header2   Measure1   Measure2   Measure3 
 ABC                            1.0                         43.7                         64.4                         94.9
 ABC                            2.0                         23.8                         80.5                         35.5
 ABC                            3.0                         22.4                         46.5                         64.9
 ABC                            4.0                         80.4                         67.9                         56.2
 ABC                            5.0                         16.5                         85.1                           3.2
 DEF                            1.0                         28.5                           6.5                         63.5
 DEF                            2.0                         38.4                         30.2                         17.7
 DEF                            3.0                         79.1                         39.4                         47.1
 DEF                            4.0                         83.3                         73.4                         42.3
 DEF                            5.0                         98.5                         38.6                         11.1
 DEF                            6.0                         85.0                         77.8                         85.3

 

Try this

Header1 Header2 Measure Value
ABC 1 1                         43.7
ABC 2 1                         23.8
ABC 3 1                         22.4
ABC 4 1                         80.4
ABC 5 1                         16.5
DEF 1 1                         28.5
DEF 2 1                         38.4
DEF 3 1                         79.1
DEF 4 1                         83.3
DEF 5 1                         98.5
DEF 6 1                         85.0
ABC 1 2                         64.4
ABC 2 2                         80.5
ABC 3 2                         46.5
ABC 4 2                         67.9
ABC 5 2                         85.1
DEF 1 2                           6.5
DEF 2 2                         30.2
DEF 3 2                         39.4
DEF 4 2                         73.4
DEF 5 2                         38.6
DEF 6 2                         77.8
ABC 1 3                         94.9
ABC 2 3                         35.5
ABC 3 3                         64.9
ABC 4 3                         56.2
ABC 5 3                           3.2
DEF 1 3                         63.5
DEF 2 3                         17.7
DEF 3 3                         47.1
DEF 4 3                         42.3
DEF 5 3                         11.1
DEF 6 3                         85.3

 

@aliasadivet after you alter the data model, it should be easier to determine which of the seven measures are present or not.

Thank you!

I just solved my issue using INT function. NewColumn = (INT('Table'[field1])+...INT('Table'[field7]))/7

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.