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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Comex_Palmali
New Member

Last Status based on Date

Hello guys, 

How are you doing?

 

I'm currently working on a project to determine the activation of clients based on the date of their last purchase.

 

Each client can have multiple contracts made in different dates, so we determined as follows:
- Last contract was on 2021 is critical;

- Last contract from 01/01/2022 until 6 months before today needs atention;
- Last contract 6 month til today is OK.

 

I've used this formula to check their activity status:

Atividade = IF(Fato_Comex_Movimento[Ano_PI]<=2021,"Crítico",IF(MONTH(TODAY())-Fato_Comex_Movimento[Mês PI]<=6,"OK","Atenção"))

 

And the result was this matrix:

Comex_Palmali_0-1666105270162.png 

But as you can see in the image, the last contract of the client 4 was on 23/03/2022 so it should be "Atention", not "Critical"

 

So the expected result should be like this:

 

Comex_Palmali_1-1666105712511.png

 

If I change to "First Ativididade" instead of "Last Atividade" the matrix becomes even worse...

How can I fix this?

 

At the end I would need to inform how many are OK, Atention or Critical. But I think I can do that using filters on the cards for the dashboard.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Comex_Palmali , refer if my blog on the same can help

https://amitchandak.medium.com/power-bi-get-the-last-latest-value-of-a-category-d0cf2fcf92d0

https://amitchandak.medium.com/power-bi-get-the-sum-of-the-last-latest-value-of-a-category-f1c839ee8...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
Comex_Palmali
New Member

It was exactly what I needed!

You have solved a lot of my problems here!

 

Thank you!

amitchandak
Super User
Super User

@Comex_Palmali , refer if my blog on the same can help

https://amitchandak.medium.com/power-bi-get-the-last-latest-value-of-a-category-d0cf2fcf92d0

https://amitchandak.medium.com/power-bi-get-the-sum-of-the-last-latest-value-of-a-category-f1c839ee8...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.