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
astarkey
Frequent Visitor

count anything OLDER than previous month

any help here will be most appreciated!!

 

I'm trying to create a measure that will count records older than the previous month..

 

So if today anything older than the 1st of March (feb and back) I can do this in a card with filters quite easily, by setting a date, something I then have to alter at the start of each month to keep the number correct...

 

However I don't want to do that and I also need the measure to help create a percentage figure.

 

I've tried.....

 

older than previous month = CALCULATE(DISTINCTCOUNT(AllJobView[JTJobNo]), < PREVIOUSMONTH('AllJobView'[jtpromisedate]))

 

but it doesnt like the "<"

 

When I remove it, I get an error saying that the specified column is not a date type (this is probably a totally seperate issue... It is a date field)

 

but no luck

 

i'm basically trying to count jobs that are feb and older, then next month march and older etc.... but want to do this without manual filter setting each month.

 

cheers

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi there,

 

You can get away without creating a Date table but you might want to consider adding one later on.

Here are a couple of options just using your AllJobView table:

 

 

older than previous month =
CALCULATE (
    DISTINCTCOUNT ( AllJobView[JTJobNo] ),
    AllJobView[jtpromisedate] <= EOMONTH ( TODAY (), -2 )
)
Count before previous month = 
CALCULATE ( 
    DISTINCTCOUNT ( AllJobView[JTJobNo] ),
    DATESBETWEEN ( AllJobView[jtpromisedate], BLANK(), EOMONTH( TODAY(), -2 ) )
)

 

Regards,

Owen

 


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

View solution in original post

2 REPLIES 2
OwenAuger
Super User
Super User

Hi there,

 

You can get away without creating a Date table but you might want to consider adding one later on.

Here are a couple of options just using your AllJobView table:

 

 

older than previous month =
CALCULATE (
    DISTINCTCOUNT ( AllJobView[JTJobNo] ),
    AllJobView[jtpromisedate] <= EOMONTH ( TODAY (), -2 )
)
Count before previous month = 
CALCULATE ( 
    DISTINCTCOUNT ( AllJobView[JTJobNo] ),
    DATESBETWEEN ( AllJobView[jtpromisedate], BLANK(), EOMONTH( TODAY(), -2 ) )
)

 

Regards,

Owen

 


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

Top Man!!

This simple looking fix is going to help me across a number of my reports! Cheers

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.