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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
hidzirf
Helper I
Helper I

Count row with filter condition

Hello Experts,

 

I need help. I have a set of data that consist of 12-month data. I already created a measure 

AllCount = COUNT(Table[Colum]). Now I would like to create another measure to count the row but only for the last 1 month. How can I do that?
 
Thank you.
1 ACCEPTED SOLUTION

@hidzirf Please try this:-

 

Measure = CALCULATE(DISTINCTCOUNT('Table (2)'[Number]),FILTER('Table (2)',MONTH('Table (2)'[Date]) = MONTH( TODAY())-1))

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

View solution in original post

4 REPLIES 4
Samarth_18
Community Champion
Community Champion

Hi @hidzirf ,

 

You can create a measure like below:-

measure = countrows(filter(table,table[date] = today()-30))

 

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Hi Samarth,

 

Thank you for your reply. I have tried the measure that you have shared but the result is not correct - showing as blank.

I'm giving you another example as below table.

 

Number

Question Type

Result

Date

PART123

Why

3

28/2/2022

PART123

How

3

28/2/2022

PART123

Where

4

28/2/2022

PART123

What

4

28/2/2022

PART456

Why

2

15/2/2022

PART456

How

3

15/2/2022

PART456

Where

3

15/2/2022

PART456

What

4

15/2/2022

PART789

Why

5

10/1/2022

PART789

How

4

10/1/2022

PART789

Where

3

10/1/2022

PART789

What

2

10/1/2022

PART000

Why

5

1/1/2022

PART000

How

3

1/1/2022

PART000

Where

2

1/1/2022

PART000

What

2

1/1/2022

 

I would like to create a measure to show the number of participants on a card. So each participant needs to answer 4 types of questions. So I created a measure DISTINCTCOUNT(Table[Number]) to have the total numbers of participants which is 4. And now I have to create another measure to show how many participants for last month (February) which is should be 2.

Please let me know if you have any other suggestions.Thank you.

 

Regards,

@hidzirf Please try this:-

 

Measure = CALCULATE(DISTINCTCOUNT('Table (2)'[Number]),FILTER('Table (2)',MONTH('Table (2)'[Date]) = MONTH( TODAY())-1))

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Hi Samarth,

 

I appreciate your help so much. You have always provided me with a solution that has worked. Thanks a lot.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors