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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
richrich123
Helper III
Helper III

Filtering data based on last created

Morning,

 

I'm a bit stumped on this, it seemed easy at first glance of the request but maybe not.

 

I have a table with all vacancies by client. I want to see a table of the clients who have not had a vacancy created in the last 12 months. So as in this test data sample below, Drawing Enterrpise have added a job in the last 12 months so can be excluded but Farmouse Trading haven't had any new jobs added in the last 12 months so would be listed

 

richrich123_1-1649328311484.png

 

Many Thanks

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @richrich123 

 

Did you solve this problem? If not, this is a DAX method you can use. 

 

Create the following measure and add it on the table visual as a visual-level filter. Set its value to 1. This measure will get the last vacancy created date for every client and compare it to the date last year (based on today).

 

Flag = 
var _lastDate = CALCULATE(MAX('Table'[Vacancy Created]),ALLEXCEPT('Table','Table'[Client]))
return
IF(_lastDate < EDATE(TODAY(),-12), 1, 0)

 

vjingzhang_0-1650016492656.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

4 REPLIES 4
v-jingzhang
Community Support
Community Support

Hi @richrich123 

 

Did you solve this problem? If not, this is a DAX method you can use. 

 

Create the following measure and add it on the table visual as a visual-level filter. Set its value to 1. This measure will get the last vacancy created date for every client and compare it to the date last year (based on today).

 

Flag = 
var _lastDate = CALCULATE(MAX('Table'[Vacancy Created]),ALLEXCEPT('Table','Table'[Client]))
return
IF(_lastDate < EDATE(TODAY(),-12), 1, 0)

 

vjingzhang_0-1650016492656.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

richrich123
Helper III
Helper III

Hi @Vijay_A_Verma ,

 

Many thanks for you help. I have tried that and ammended the source (if I have isolted the source part correctly, I swapped this out:

 

Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Zc7BDcAgCAXQXTybIGjT9qhVlzDuv0YBTWjSyz88yIcxXHbeZYkD8AYKhG76zYUDAS/hoCxSZBY3o7FEglOUTB8OArSKylDzr1m56DKZNob2vbe4s/Ss92KwN5RXB6bN8wU=", BinaryEncoding.Base64)

 

richrich123_0-1649333498038.png

Must have something wrong still? I just dropped the new query into a table but just see the code.

 

Thanks

Do like this

Import from your source

Go to Advanced editor and delete everything after source line (make sure to put a comma after the source line).

Now copy my code from #"Changed Type" till end

Paste into Advanced editor

Vijay_A_Verma
Super User
Super User

Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test (later on when you use the query on your dataset, you will have to change the source appropriately)

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Zc7BDcAgCAXQXTybIGjT9qhVlzDuv0YBTWjSyz88yIcxXHbeZYkD8AYKhG76zYUDAS/hoCxSZBY3o7FEglOUTB8OArSKylDzr1m56DKZNob2vbe4s/Ss92KwN5RXB6bN8wU=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Client = _t, Vacancy = _t, #"Vacancy Created" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Client", type text}, {"Vacancy", type text}, {"Vacancy Created", type date}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Client"}, {{"MaxDate", each List.Max([Vacancy Created]), type nullable date}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Date.AddYears(Date.From(DateTime.FixedLocalNow()),-1)<=[MaxDate]),
    #"Filtered Rows" = Table.SelectRows(#"Added Custom", each ([Custom] = true)),
    #"Merged Queries" = Table.NestedJoin(#"Changed Type", {"Client"}, #"Filtered Rows", {"Client"}, "Filtered Rows", JoinKind.Inner),
    #"Removed Columns" = Table.RemoveColumns(#"Merged Queries",{"Filtered Rows"})
in
    #"Removed Columns"

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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