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
Elisa112
Helper III
Helper III

Count Rows for this month and between a specific range

Hi Experts

I have a summarised table which I am trying to count the number of occurences for this month between a specific range of values for Active customers only

 

Here is my example data

 

CustID    Status    Date             Number of orders 

001         Active        1 jan                  200

002         Closed       1 Jan                 50

003         Active        3 Jan                 250

004         Active        4 Jan                350

005         Active        5 Jan                1000

 

I am looking to count customer rows for January (or current month) which are active and between the range of over 200 and less than 350 orders

 

here is my dax but it is bringing blank rather than 3

 

Orders between 200-350 this month = CALCULATE(

        COUNTROWS('Customer Summary Table'),
        FILTER('Customer Summary Table', MONTH('Customer Summary Table'[date])= MONTH(TODAY()) &&  YEAR('Customer Summary Table'[Date]) = YEAR(TODAY()) && 'Customer Summary Table'[Status] = "Active" && 'Customer Summary Table'[Number of Orders] > 200 && 'Customer Summary Table'[Number of Orders] < 350
))

Thanks in advance

1 ACCEPTED SOLUTION
vicky_
Super User
Super User

Your measure is working fine for me - i just made some adjustment based on your sample data to only look at Jan 2024

vicky__0-1730326548476.png

BTW - if your expected results are 3 for the sample data above, you'll need to use >= and <=

I'm not sure what your actual data / report looks like, but you can check if you've got any other filters causing the result to be blank on your report by going to the top-right of the visual and checking there. 

vicky__1-1730326693423.png

 

View solution in original post

2 REPLIES 2
vicky_
Super User
Super User

Your measure is working fine for me - i just made some adjustment based on your sample data to only look at Jan 2024

vicky__0-1730326548476.png

BTW - if your expected results are 3 for the sample data above, you'll need to use >= and <=

I'm not sure what your actual data / report looks like, but you can check if you've got any other filters causing the result to be blank on your report by going to the top-right of the visual and checking there. 

vicky__1-1730326693423.png

 

Thanks, yes it works correctly

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.