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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
pzcannon
Frequent Visitor

How to count number of occurrence of a value in a column

Hi,

 

I'm pretty new to powerBI and I've been trying out DAX to count the number of times a Date (DD/MM/YYYY) appears in a column.

 

Basically, I have a table with the following columns: Issue, Date Reported, Date Solved. I'm trying to count the number of items reported and addressed on a certain date.

 

Date#Reported#Solved
1/1/2021  
2/1/2021  
3/1/2021  
4/1/2021  

 

 

Can someone help me out. Thanks!

 

Sincerely,

Patrick

1 ACCEPTED SOLUTION

Hi @pzcannon ,

I created a sample pbix file for you, please check whether that is what you want.

1. Create a date dimension table

Date = CALENDAR(MIN('Table'[Date Reported]),MAX('Table'[Date Solved]))

2. Create 2 measures as below to get the counts of item reported and item resolved

Items Reported = CALCULATE(DISTINCTCOUNT('Table'[# Description]),FILTER('Table','Table'[Date Reported]=SELECTEDVALUE('Date'[Date])))+0
Items Solved = CALCULATE(DISTINCTCOUNT('Table'[# Description]),FILTER('Table','Table'[Date Solved]=SELECTEDVALUE('Date'[Date])))+0

yingyinr_0-1622452546368.png

Best Regards

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

View solution in original post

4 REPLIES 4
Jihwan_Kim
Super User
Super User

Hi, @pzcannon 

Try something like below.

 

Reported count measure =
CALCULATE (
COUNTROWS ( 'your table name' ),
'your table name'[yourcolumnname] = "Reported"
)

 

Solved count measure =
CALCULATE (
COUNTROWS ( 'your table name' ),
'your table name'[yourcolumnname] = "Solved"
)

 

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Hi, @Jihwan_Kim.

Thanks for your response. I think I didn't word it properly.

What I'm trying to do is to generate Table 2 from Table 1:

 

Table 1:

# Description Date Reported Date Solved
1 Issue 1 1-Jan 1-Jan
2 Issue 2 1-Jan 2-Jan
3 Issue 3 2-Jan 2-Jan
4 Issue 4 2-Jan 3-Jan
5 Issue 5 4-Jan 4-Jan

Table 2:

Date Items Reported Items Solved
1-Jan 2 1
2-Jan 2 2
3-Jan 0 1
4-Jan 1 0
5-Jan 0 1

 

Really appreciate your help. Thanks!

 

Sincerely,

@pzcannon

 

Hi @pzcannon ,

I created a sample pbix file for you, please check whether that is what you want.

1. Create a date dimension table

Date = CALENDAR(MIN('Table'[Date Reported]),MAX('Table'[Date Solved]))

2. Create 2 measures as below to get the counts of item reported and item resolved

Items Reported = CALCULATE(DISTINCTCOUNT('Table'[# Description]),FILTER('Table','Table'[Date Reported]=SELECTEDVALUE('Date'[Date])))+0
Items Solved = CALCULATE(DISTINCTCOUNT('Table'[# Description]),FILTER('Table','Table'[Date Solved]=SELECTEDVALUE('Date'[Date])))+0

yingyinr_0-1622452546368.png

Best Regards

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

Hi, @pzcannon 

Thank you for your feedback.

I am not sure if I understood your second question correctly, but please check the below.

 

Picture1.png

 

Items Reported =
CALCULATE (
COUNTROWS ( 'Table' ),
USERELATIONSHIP ( 'Calendar'[Date], 'Table'[Date Reported] )
)
 
Items Solved =
CALCULATE (
COUNTROWS ( 'Table' ),
USERELATIONSHIP ( 'Calendar'[Date], 'Table'[Date Solved] )
)
 
 

Hi, My name is Jihwan Kim.


If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors
Top Kudoed Authors