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
Anonymous
Not applicable

Count ifS in Power BI

In Excel, I had created the below column and formula which checked several columns and if they were a match would count that instance.  I would like to set up a similar column in Power BI however it needs to be dynamic as the PowerBI will become a template and needs to be calculated on the fly with each new set of raw data. 

 

I have created a new column and have been playing with SWITCH and COUNTX but haven't cracked it yet. 

 

Any help greatly appreciated

 

 

CountIF.jpg

4 REPLIES 4
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous ,

Could you please post some simple sample data and your desired result to have a test if possible? Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Ashish_Mathur
Super User
Super User

Hi,

 

Drag columns, B,D,W,AA to the visual and then write this measure

 

=CALCULATE(COUNTROWS(Data),Data[Is the space occupied]="Empty")

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Thanks so much for the quick reply. Sorry to say, I am not sure what you mean by "Drag columns, B,D,W,AA to the visual"

 

However, I do need the calculated number in each row of the column as becomes part of a stacked chart. Sorry - sounds complicated!

Hi,

 

You have to first load data from your Excel file into PowerBI desktop and then select the Table visual.  Drag those columns to the visual and then write the measure i suggested.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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.