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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
azahrani
New Member

count total from different column with condition

i have a table had two column , this two column contains names sometimes name " A " will appear in column1 and sometimes name "A" will appear in coumn 2 , how can i count total of  "A" wather appeared in column1 or column2 

example

column1column2
AB
BA

 

i want to select from dropdown list "A" then it will calculate how many from both column

1 ACCEPTED SOLUTION
speedramps
Community Champion
Community Champion

Try this ...

 

Go into Power Query (Edit query).

Select both columns.

Click on Transform / Unpivot Columns.

 

Before ...

speedramps_0-1662310222834.png

 

After ...

speedramps_1-1662310254553.png

 

I trust that you can write the Power Bi report to count how many now ?

 

Thanks for reaching out for help.

I put in a lot of effort to help you, now please quickly help me by giving kudos.

Remeber we are unpaid volunteers and here to coach you with Power BI and DAX skills and techniques, not do the users job for them. So please click the thumbs up and accept as solution button. 

If you give someone a fish then you only give them one meal, but if you teach them how to fish then they can feed themselves and teach others for a lifetime.  I prefer to teach members on this forum techniques rather give full solutions and do their job. You can then adapt the technique for your solution, learn some DAX skills for next time and soon become a Power BI Super User like me. 

One question per ticket please. If you need to extend your request then please raise a new ticket.

You will get a quicker response and each volunteer solver will get the kudos they deserve. Thank you ! 

 

 

View solution in original post

3 REPLIES 3
v-jingzhang
Community Support
Community Support

Hi @azahrani 

 

Have you tried @speedramps 's solution? It is great and simple. 

 

Otherwise if you don't want to transform the current table, you can try my method as below. This is a DAX method. First create a new table to have all distinct names from two columns. Use this new table's column in a drop-down slicer. 

vjingzhang_0-1662435038494.png

Then create the following measure to calculate the total count. 

Total = CALCULATE(COUNT('Table'[column1]),'Table'[column1] IN VALUES('Table 2'[column1])) + CALCULATE(COUNT('Table'[column2]),'Table'[column2] IN VALUES('Table 2'[column1]))

vjingzhang_1-1662435128457.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

speedramps
Community Champion
Community Champion

Try this ...

 

Go into Power Query (Edit query).

Select both columns.

Click on Transform / Unpivot Columns.

 

Before ...

speedramps_0-1662310222834.png

 

After ...

speedramps_1-1662310254553.png

 

I trust that you can write the Power Bi report to count how many now ?

 

Thanks for reaching out for help.

I put in a lot of effort to help you, now please quickly help me by giving kudos.

Remeber we are unpaid volunteers and here to coach you with Power BI and DAX skills and techniques, not do the users job for them. So please click the thumbs up and accept as solution button. 

If you give someone a fish then you only give them one meal, but if you teach them how to fish then they can feed themselves and teach others for a lifetime.  I prefer to teach members on this forum techniques rather give full solutions and do their job. You can then adapt the technique for your solution, learn some DAX skills for next time and soon become a Power BI Super User like me. 

One question per ticket please. If you need to extend your request then please raise a new ticket.

You will get a quicker response and each volunteer solver will get the kudos they deserve. Thank you ! 

 

 

thank you very much that solved my issue 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.