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
grggmrtn
Post Patron
Post Patron

If last two values have a difference of more than 2, then do something?

There should be an easy fix for this, but I'm not quite sure how to do it.

 

The data is simple: Name, date, value:

Bob01-01-202099
Bob01-03-202098
Bob01-05-202096
Jane02-01-202077
Jane02-02-202076
Jane02-03-202078
Kenneth01-06-202066

Because the difference for Bob's last two values is >= 2, I need to flag it somehow. Jane and Kenneth don't need anything, because Jane's last 2 values have a difference of -2 and since it's a rise it doesn't need to be flagged, and Kenneths value can't be compared to anything because there's only the one.

 

It's ONLY the last two values that are important. For example if Bob gets updated on 01-06-2020 and the value is 95, he no longer needs to be flagged.

 

The end result should be a list of names that are flagged.

 

I'd appreciate any help I can get, thanks!

1 ACCEPTED SOLUTION
v-lionel-msft
Community Support
Community Support

Hi @grggmrtn ,

 

Please refer to my .pbix file.

v-lionel-msft_0-1604563492708.png

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-lionel-msft
Community Support
Community Support

Hi @grggmrtn ,

 

Please refer to my .pbix file.

v-lionel-msft_0-1604563492708.png

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@grggmrtn , Create a new column that will flag for that row, You can filter a get name

Column = var _1  = maxx(FILTER('Table','Table'[Name]= EARLIER('Table'[Name]) && 'Table'[Date] < EARLIER('Table'[Date])),LASTNONBLANKVALUE('Table'[Date],'Table'[Value])) return If(ISBLANK(_1), BLANK(),if( _1 -[Value] >=2,1,0))

 

file is attached after signature

 

Thanks for this @amitchandak - it's almost exactly what I'm looking for 🙂

 

The problem comes since your column is looking at all dates instead of just the last two. Here's an example from my data (the colours indicate three different names in this column)

grggmrtn_1-1604404943181.png

If I filter this list by [Column] then "blue" will also be in this list, even though the difference between their values of the last two dates < 0. So my flags won't tell me what the situation is TODAY when I'm looking at the report. According to the above data, only "yellow" should the only one that has a 1.

 

Make any sense?

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.