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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
susheeltyagi
Helper I
Helper I

How to count the number of records (row count) under next one month

Hi,

 

I am trying to find the formula inwhich select the item count for expiry date fall under next 30 days from the today date.

I mean display the number of item that will expire by next 30 days from today date.

 

Example: If 4 item will expire within next 30 days from today date then DAX or formula will retuen "4"

 

ProductTable

ItemIDExpiryDate
1882022-06-15 23:59
1892022-01-15 23:59
3682021-04-25 23:59
3692021-05-29 23:59
3662021-03-25 23:59
3672021-06-25 23:59
492021-06-04 23:59
3632021-07-25 23:59
3642021-08-25 23:59
1 ACCEPTED SOLUTION

Hi, @susheeltyagi 

Terribly sorry that I still cannot understand.

I have your sample data, but your expected result is using different data.

It does not help me to understand your question.

 

I assume you do not want to show/count the earlier date than today. Is it correct? But I still wonder that I am still wrong. Because in your initial question, your expected result was 4. And result 4 includes the earlier date than today.

 

Please check below whether my assumption is what you are looking for.

 

https://www.dropbox.com/s/avx7gpnmz8zgock/susheel.pbix?dl=0 

 

Picture3.png

 

Expiry within next 30 days V2 =
VAR expirydate =
TODAY () + 30
RETURN
COUNTROWS ( FILTER ( 'Table', 'Table'[ExpiryDate] < expirydate && 'Table'[ExpiryDate]>=TODAY() ) )
 

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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

7 REPLIES 7
Jihwan_Kim
Super User
Super User

Hi, @susheeltyagi 

Please check the below picture and the sample pbix file's link down below.

 

Picture2.png

 

Expiry within next 30 days =
VAR expirydate =
TODAY () + 30
RETURN
COUNTROWS ( FILTER ( 'Table', 'Table'[ExpiryDate] < expirydate ) ) + 0

 

 

https://www.dropbox.com/s/avx7gpnmz8zgock/susheel.pbix?dl=0 

 

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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

My Friend

 

Thanks for quick reply.

Its working now but its showing me the records from back date from today.

I need the number of record from today date to next 30 Days,

 

Expiry within next 30 days =
VAR expirydate = TODAY () + 30
RETURN
COUNTROWS ( FILTER ( MeasurementQuery, MeasurementQuery[SensorExpiry] < expirydate ))+ 0

 

Hi, @susheeltyagi 

Thank you for your feedback.

I am not sure what is your data type of the SensorExpiry Column. Is it date type? 

In my opinion, you need to change this data type in Power Query Editor, not in Power BI Table View.

Or, please share your sample pbix file's link here, then I can try to look into it to come up with a more accurate measure.


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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.


Its working now but its showing me the records from back date also from today.

I need the number of record from today date to next 30 Days,


Expiry within next 30 days =
VAR expirydate = TODAY() + 30 RETURN
COUNTROWS ( FILTER ( MeasurementQuery, MeasurementQuery[SensorExpiry] < expirydate ))

Sorry, I don't understand your question.

Share your sample pbix file's link and let me know how your desired outcome looks like.


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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

HI,

 

Sorry to bother you. Actually I need to display the number Sensors or Products that will expire in next 30 days. If any product has sensor expire date has Yesterday or less then today date that mean that have already been expired.

So we have Highlit on our Dashboard that these are number of Items will expire within next 30 days.

 

susheeltyagi_0-1622032145053.png

 

Hi, @susheeltyagi 

Terribly sorry that I still cannot understand.

I have your sample data, but your expected result is using different data.

It does not help me to understand your question.

 

I assume you do not want to show/count the earlier date than today. Is it correct? But I still wonder that I am still wrong. Because in your initial question, your expected result was 4. And result 4 includes the earlier date than today.

 

Please check below whether my assumption is what you are looking for.

 

https://www.dropbox.com/s/avx7gpnmz8zgock/susheel.pbix?dl=0 

 

Picture3.png

 

Expiry within next 30 days V2 =
VAR expirydate =
TODAY () + 30
RETURN
COUNTROWS ( FILTER ( 'Table', 'Table'[ExpiryDate] < expirydate && 'Table'[ExpiryDate]>=TODAY() ) )
 

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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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.