troubleshooting Question

Countif Function in t-SQL or Power BI

Avatar of Wm Allen Smith
Wm Allen Smith asked on
Microsoft SQL ServerMicrosoft ExcelSQLPower BI
5 Comments1 Solution65 ViewsLast Modified:
Countif Function in t-SQL

Is there a way to mimic this excel formula in Sql:
(COUNTIF($A$2:$A2,$A2)=1)+0


This formula starts at row A2 and fills down to the end of the range, counting the occurrences of the value in the previous row. If a value occurs once, then the count is 1, else 0. Can this be done in SQL or Power BI?
sample.xlsx
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros