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
dnhmm
Regular Visitor

Dax - Count specific value from several columns in a row

Hi, I am fairly new to Power BI and I need your help so I can get the final result on column "Count 1".

Basically I want to count how many "ones" are between "Action 1" and "Action 7" columns for the entire row.

Any suggestions would be much appreciated!

Thank you very much!

 

Example:

'Clients Actions'

 

CustomerAction 1Action 2Action 3Action 4Action 5Action 6Action 7Count 1
A 133 1 2
B1 2 67 1
C783    0
D 4712  1
E1381  13
1 ACCEPTED SOLUTION
v-huizhn-msft
Employee
Employee

Hi @dnhmm,

Please create a calcualted column using the formula below.

Column = IF(Table1[Action 1]=1,Table1[Action 1],0)+IF(Table1[Action 2]=1,Table1[Action 2],0)+IF(Table1[Action 3]=1,Table1[Action 3],0)+IF(Table1[Action 4]=1,Table1[Action 4],0)+IF(Table1[Action 5]=1,Table1[Action 5],0)+IF(Table1[Action 6]=1,Table1[Action 6],0)+IF(Table1[Action 7]=1,Table1[Action 7],0)

You will get expected result as the screenshot shows.

1.PNG

Best Regards,
Angelia

View solution in original post

2 REPLIES 2
v-huizhn-msft
Employee
Employee

Hi @dnhmm,

Please create a calcualted column using the formula below.

Column = IF(Table1[Action 1]=1,Table1[Action 1],0)+IF(Table1[Action 2]=1,Table1[Action 2],0)+IF(Table1[Action 3]=1,Table1[Action 3],0)+IF(Table1[Action 4]=1,Table1[Action 4],0)+IF(Table1[Action 5]=1,Table1[Action 5],0)+IF(Table1[Action 6]=1,Table1[Action 6],0)+IF(Table1[Action 7]=1,Table1[Action 7],0)

You will get expected result as the screenshot shows.

1.PNG

Best Regards,
Angelia

Many Thanks!!

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.