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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
asodhani
Frequent Visitor

count specific text in a row

Dear Team,

 

I have a table

 

Column 1Column 2Column 3Column 4Column 5Column 6Count of NotCompleted
CompletedNotCompletedCompletedNotCompletedNotCompletedCompleted3
CompletedCompletedNotCompletedCompletedCompletedCompleted1

 

How to write a dax function to calculate the count of NotCompleted?

 

Thank You

2 ACCEPTED SOLUTIONS
Phil_Seamark
Microsoft Employee
Microsoft Employee

HI @asodhani

 

If you don't mind a bit of hardcoding this calculated column will work

 

Column = 
VAR S = "NotCompleted"
RETURN 
    IF('Table3'[Column 1]=S,1) +
    IF('Table3'[Column 2]=S,1) +
    IF('Table3'[Column 3]=S,1) +
    IF('Table3'[Column 4]=S,1) +
    IF('Table3'[Column 5]=S,1) +
    IF('Table3'[Column 6]=S,1) 

Otherwise, unpivot the data to rows and you can sum over a single column


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

Hi @asodhani

 

Please give this a try.

 

Column = 

    IF('Table3'[Column 1]="NotCompleted",1) +
    IF('Table3'[Column 2]="NotCompleted",1) +
    IF('Table3'[Column 3]="NotCompleted",1) +
    IF('Table3'[Column 4]="NotCompleted",1) +
    IF('Table3'[Column 5]="NotCompleted",1) +
    IF('Table3'[Column 6]="NotCompleted",1) 

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

6 REPLIES 6
Phil_Seamark
Microsoft Employee
Microsoft Employee

HI @asodhani

 

If you don't mind a bit of hardcoding this calculated column will work

 

Column = 
VAR S = "NotCompleted"
RETURN 
    IF('Table3'[Column 1]=S,1) +
    IF('Table3'[Column 2]=S,1) +
    IF('Table3'[Column 3]=S,1) +
    IF('Table3'[Column 4]=S,1) +
    IF('Table3'[Column 5]=S,1) +
    IF('Table3'[Column 6]=S,1) 

Otherwise, unpivot the data to rows and you can sum over a single column


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

@Phil_Seamark

 

I can only do VAR.S but then it asks me for a column name. also I am unsure how to add the Return Formula after that.

 

Will be great if you can assist

Hi @asodhani

 

Are you creating it as a calculated column in a Power BI table?


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

@Phil_Seamark

 

Yes that is correct.

 

Unable to find the best option

 

 var.s.pngvar.s2.png

Hi @asodhani

 

Please give this a try.

 

Column = 

    IF('Table3'[Column 1]="NotCompleted",1) +
    IF('Table3'[Column 2]="NotCompleted",1) +
    IF('Table3'[Column 3]="NotCompleted",1) +
    IF('Table3'[Column 4]="NotCompleted",1) +
    IF('Table3'[Column 5]="NotCompleted",1) +
    IF('Table3'[Column 6]="NotCompleted",1) 

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

How to unpivot data to rows? I have this table directly coming from a ERP Database

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.