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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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.


Go to My LinkedIn Page


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.


Go to My LinkedIn Page


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.


Go to My LinkedIn Page



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.


Go to My LinkedIn Page


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.


Go to My LinkedIn Page


Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.