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
pbilearning
Helper I
Helper I

how to check for ID's with change in status/category from last 3 months, 6 months, 9 months etc

Hi Everyone,

 

I have a quick doubt please if anyone can help?

 

I am working on a data provided with ID's, months starting from June'19 to March'20(which will extend till June'20) and category/state(text data) of id. I want to look for ID's that have not changed their state from last 3 months, last 6 months,  last 9 months and so on. Can we do that on powerbi? 

categorytrace.JPG

1 ACCEPTED SOLUTION

Updated and attached:

 

3 Months the Same Column = 
  VAR __Current = [Category]
  VAR __Table = FILTER('FactTable1',[Month] <= EARLIER([Month]) && [Month] >= (EARLIER([Month]) - 90) && [ID] = EARLIER([ID]))
  VAR __Check = FILTER(__Table, [Category] <> __Current)
RETURN
  IF(ISBLANK(COUNTROWS(__Check)), "Same", "Changed")

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

6 REPLIES 6
Greg_Deckler
Super User
Super User

Yes, you would generally do that something like:

 

3 Months the Same Column =
  VAR __Current = [Category]
  VAR __Table = FILTER('Table',[Month] >= ([Month] - 90))
  VAR __Check = FILTER(__Table, [Category] <> __Current)
RETURN
  IF(ISBLANK(__Check), "Same", "Changed")

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler 

 

I tried your formula by adding another column in data, but I am getting below error on power bi. Is there anything I am doing wrong3months.JPG

@Greg_Deckler 

I have attached excel file and PBI for your reference.Excel File (Sample) PBI  

 

Really Thanks for your help! 🙂

OK, sorry, try this:

 

3 Months the Same Column = 
  VAR __Current = [Category]
  VAR __Table = FILTER('FactTable1',[Month] >= ([Month] - 90) && [ID] = EARLIER([ID]))
  VAR __Check = FILTER(__Table, [Category] <> __Current)
RETURN
  IF(ISBLANK(COUNTROWS(__Check)), "Same", "Changed")

 

PBIX is attached:

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler 

 

Thanks for your quick help 🙂

 

It is working, but its working for account changin for all months rather than just 3 months or 6 months or 9 months.  I have attached PBI with data for other months entire.JPG data included and screenshot for your reference

Updated and attached:

 

3 Months the Same Column = 
  VAR __Current = [Category]
  VAR __Table = FILTER('FactTable1',[Month] <= EARLIER([Month]) && [Month] >= (EARLIER([Month]) - 90) && [ID] = EARLIER([ID]))
  VAR __Check = FILTER(__Table, [Category] <> __Current)
RETURN
  IF(ISBLANK(COUNTROWS(__Check)), "Same", "Changed")

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.