cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Patron
Post Patron

CALCULATE with LASTDATE

Hello,

 

i try to find a way to integrate LASTDATE in a calculation. A possibility is:

 

VAR LD = LASTDATE(Table1[Date])

RETURN Number = CALCULATE(COUNT(Table1[PNR]); Table1[Part] <> "B"; Table1[Date] = LD)

 

The problem is that i dont have the last date considering Table1[Part] <> "B". Some ideas what to adjust?

1 ACCEPTED SOLUTION

Accepted Solutions
Super User IX
Super User IX

Re: CALCULATE with LASTDATE

VAR LD = CALCULATE(LASTDATE(Table1[Date]),Table1[Part] <> "B")

RETURN Number = CALCULATE(COUNT(Table1[PNR]); Table1[Part] <> "B"; Table1[Date] = LD)

---------------------------------------

@ me in replies or I'll lose your thread!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




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

Proud to be a Super User!




View solution in original post

2 REPLIES 2
Super User IX
Super User IX

Re: CALCULATE with LASTDATE

VAR LD = CALCULATE(LASTDATE(Table1[Date]),Table1[Part] <> "B")

RETURN Number = CALCULATE(COUNT(Table1[PNR]); Table1[Part] <> "B"; Table1[Date] = LD)

---------------------------------------

@ me in replies or I'll lose your thread!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




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

Proud to be a Super User!




View solution in original post

Highlighted
Super User IX
Super User IX

Re: CALCULATE with LASTDATE

@Pikachu-Power , try like

CALCULATE(COUNT(Table1[PNR]); Table1[Part] <> "B"; Table1[Date] = lastdate(Table1[Date] ))



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Helpful resources

Announcements

August Community Highlights

Check out a full recap of the month!

Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.

Top Solution Authors