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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
PowerBI123456
Post Partisan
Post Partisan

Excluding based on criteria

Hi, hope this makes sense. But I have a list of claims that can have multiple release dates such as below:

PowerBI123456_5-1594418272314.png

 

Each claim might have an edit associated with it below:

 

PowerBI123456_3-1594418235676.png

 

I want to exclude edits where there are multiple claim releases and if any of those release dates are before 1/1/2020. So the results would be:

PowerBI123456_6-1594418316727.png

 

I am dealing with million + rows. If anyway to do this in power query, that would be preferrable. Thanks!

 

 

 

 

2 ACCEPTED SOLUTIONS
parry2k
Super User
Super User

@PowerBI123456 add a new column in power query using following M code, assuming Jan 01st, 2020 is a fixed date

 

if [Edit Date] < #date(2020,1,1) then "Yes" else "No"

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

@PowerBI123456 See attached solution, tweak it as per your need. I hope this will get you going.

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

7 REPLIES 7
parry2k
Super User
Super User

@PowerBI123456 add a new column in power query using following M code, assuming Jan 01st, 2020 is a fixed date

 

if [Edit Date] < #date(2020,1,1) then "Yes" else "No"

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k  Thanks, but its not dependent on the edit date. I want to exclude edits where there are multiple claim releases for one particular claim ID and if any of those release dates are before 1/1/2020. Hope that makes sense!

@PowerBI123456 not entirely.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k So looking at the example below:

 

Claim A: I want to keep because there is only one claim A. 

Claim B: I want to exclude because where is more than one claim B, and one of the release dates is before 1/1/2020. 

Claim C: I want to keep because even though there is more than one claim C, both release dates are after 1/1/2020. 

 

The edit date doesn't matter. Does that help?

 

PowerBI123456_0-1594497859381.png

 

Hi  @PowerBI123456 ,

 

Create a calculated column as below:

 

Check = 
VAR _count=CALCULATE(COUNT('Table'[Claim]),FILTER('Table','Table'[Claim]=EARLIER('Table'[Claim])))
var _mindate=CALCULATE(MIN('Table'[Release]),FILTER('Table','Table'[Claim]=EARLIER('Table'[Claim])))
Return
IF(_count>1&&_mindate<DATE(2020,1,1),"Yes","No")

 

Then create a measure as below:

 

Measure = LOOKUPVALUE('Table'[Check],'Table'[Claim],MAX('Table (2)'[Claim]),blank())

 

Then you will see:

Annotation 2020-07-13 132421.png

Pls check the attachment for details.

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

@PowerBI123456 See attached solution, tweak it as per your need. I hope this will get you going.

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k  thank you!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors