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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
myou
Helper II
Helper II

Display Date of Last non blank Actual Value

Hello,

I have been struggling to build this measure

 

I have this Table 

I want to show the Date of the last non blank Actual Value, only for category = ABC

Note: Date should be less than today

So Team ID=1 

The last non blank for Actual is 100, so I want to read the corresponding date for it

DateActualteamidcateg
1/1/2020201ABC
2/1/20201001ABC
3/1/2020 1ABC
4/1/2020 1ABC
1/1/20201002XYZ
2/1/20202002XYZ
3/1/20203002XYZ
4/1/20204002XYZ
1/1/20201003ABC
2/1/20201003ABC
3/1/20201003ABC
4/1/2020 3ABC

 

Desired Output

TeamidDate
12/1/2020
33/1/2020

 

Trial:

DueDateLastFilledActual = 
var F1= Filter(Table2,Table2[Date] <=today())
return
CALCULATE(
    
    max(Table2[Date]),
    LASTNONBLANK(Table2[Actual],1)
)
1 ACCEPTED SOLUTION
camargos88
Community Champion
Community Champion

Hi @myou ,

 

Try this code:

CALCULATE(MAX('Table'[Date]); LASTNONBLANK('Table'[Actual]; 1); 'Table'[categ] = "ABC"; 'Table'[Date] <= TODAY())
 
I hope it helps,
 
Ricardo


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



View solution in original post

6 REPLIES 6
vanessafvg
Super User
Super User

hi, give this a try @myou 

 

you need to create a new table 

 

Table 2 =
SUMMARIZE (
    FILTER (
        'Table',
        'Table'[categ] = "ABC"
            && LASTNONBLANK ( 'Table'[Date], 'Table'[Actual] )
    ),
    'Table'[teamid],
    "New Date"MAX ( 'Table'[Date] ),
    "Actual"SUM ( 'Table'[Actual] )
)





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




camargos88
Community Champion
Community Champion

Hi @myou ,

 

Try this code:

CALCULATE(MAX('Table'[Date]); LASTNONBLANK('Table'[Actual]; 1); 'Table'[categ] = "ABC"; 'Table'[Date] <= TODAY())
 
I hope it helps,
 
Ricardo


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Hi @camargos88 

It shoud show March 1 for teamid2, the measure return BlankShould show March1 for teamid 2Should show March1 for teamid 2

 

camargos88
Community Champion
Community Champion

Hi @myou ,

 

TeamId 2 doesn't have ABC category, right ?

 

Also, I got this returned:

 

TeamId     Date

1               02/01/2020

3               03/01/2020

 

 



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Greg_Deckler
Super User
Super User

@myou I am having some difficulty with the logic. Is the logic

1. Find the last non blank Actual value for all teams (latest date)

2. Lookup that value for each team and get the latest date but only for teams that have that value as their latest value (latest date)

 

I ask because I see that team 2 is not included in your results.



Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler ,
I want to include only category ABC, thats why teamid 2 isnt included

For the Logic, 

1. Find the last non blank Actual value for all teams (latest date)

2. Lookup that value for each team and get the corresponding date 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.