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
Tybaal
Helper II
Helper II

Get the last status of a product

Hello all, 

I try to get the last status of a product when I select a range of date.

Example :

ProductStatusValueDate
1O10Nov, 2020
1P15Dec, 2020
 Total Mvt5 

I have these two date because I choose it in a slicer.

What I like to see is, when I remove the date column :

ProductStatusValue
1P5

I'd like to get the stastus correponding to the latest date...

 

It can be look simple but I cannot reach that...

 

Someone can help me?

 

Thank you in advance.

4 REPLIES 4
PaulDBrown
Community Champion
Community Champion

@Tybaal 

Try:

1)

Value on last date = 

VAR _prod = MAXX(ALLEXCEPT(Table, Table [Product]), MAX(Table[date]))
RETURN
CALCULATE([Sum of Value], 
           FILTER(Table, Table [date] = _prod))

2)

Status on last date =

VAR laststatus = CALCULATE([Value on last date], ALL(Table[Status]))
VAR _Prod = MAXX(ALLEXCEPT(Table, Table [Product]), MAX(Table[date]))
RETURN
CALCULATE(MAX(Table[Status]), 
           FILTER(ALL(Table), 
            [Value on last date] = laststatus && 
             Table [date] = _Prod))
 
Create your visual with the Table [Product] field and these two measures.




Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Pragati11
Super User
Super User

Hi @Tybaal ,

 

You can try something as follows by creating a measure:

LastStatus = 

var lastDate = CALCULATE(LASTDATE(tablename[Date]))

RETURN

CALCULATE(MAX(tablename[Status]), FILTER(tablename, tablename[Date] = lastDate))

 

Let me know if this works. (Replace tablename in the above DAX with your table name)

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Hello and thank you for your help!! 

I tried Pragati's solution and I success to get the last status but I have another little thing to resolve

 

Now I have this result which is closer of what I want :

1.png

Even if I removed columns "Status" and "Date" I have :

2.png

Is there a way to apply the LastStatus value to all my rows and finally get this :

3.png

Thank you in advance.

amitchandak
Super User
Super User

@Tybaal , Value in the table above is not matching with the one below

Try like for latest value

lastnonblankvalue(table[date], max(Table[Value]))

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.