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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
saumitra
Helper I
Helper I

CountIFS With Multiple Criterion

Hi All,

I want to use the CountIfs formula of Excel in Power BI for 3 criterias, which are Name, Company Name and Date. However, I am unable to do so in Power BI. 

I am using the following formula in Power BI: 

Count = Calculate(CountA(Table[Name]),Filter(Table), Table[Company Name],Table[Date])

 

After using the above formula, it says that there are too few arguments passed to the Filter function. The minimum argument is 2. 

 

I am clueless as to what it means. Kindly please provide a solution or some other alternative for my problem.

 

Thank you,

Regards,

Saumitra Upadhyaya

5 REPLIES 5
saumitra
Helper I
Helper I

I tried to Group By the columns : Name, Company and Date. In this however, the rows get reduced. So I was thinking if there is any formula to count the number of particular names? 

 

saumitra_0-1614075226308.png

Here, since there are 4 rows, it is dividing by 4. However, I want only 2 counts for Ash and 1 each for Josh and Ray respectively. Is there any method to perform this? 

Kindly please help. 

 

Thank you,

Regards,

Saumitra Upadhyaya

amitchandak
Super User
Super User

@saumitra , Create three columns like

 


countif= countx(filter(Table, [name] =earlier([name]) && [company] =earlier([company] && [Date] <=earlier([Date])), [name])

 

HC = if([countif] <=1,1,0)

 

HC1 = divide([HC],Sumx(filter(Table, [name] =earlier([name])), [HC]))

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hi Amit, 

Tried what you said but getting this error. Correct me if possible. 

 

saumitra_0-1614069530734.png

Thanks! 

amitchandak
Super User
Super User

@saumitra , what is the filter for company and date ?

example meausre 

Count = Calculate(CountA(Table[Name]),Filter(Table , Table[Company Name] = "ABC" && Table[Date] = date(2020,1,1)))

 

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hi Amit,

This is a sample of Excel data. These are the formulae I want to use in Power BI.  

saumitra_0-1614061450413.pngsaumitra_1-1614061682825.pngsaumitra_2-1614061713929.png

I hope this helps.

 

Thanks,

Regards,

Saumitra Upadhyaya

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.