cancel
Showing results for
Search instead for
Did you mean:
Highlighted
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
Highlighted
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)

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

Not link spamming! If I posted a link in reply it is because I did assume you know how to search the web but thought it was the fastest way to fix your issue.

##### 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!

2 REPLIES 2
Highlighted
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)

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

Not link spamming! If I posted a link in reply it is because I did assume you know how to search the web but thought it was the fastest way to fix your issue.

##### 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!

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

#### Microsoft Ignite

This will be a conference that you do not want to miss!

#### Get Ready for Power BI Dev Camp

Don't miss the Power BI Dev Camp this week!

#### August Community Highlights

Check out a full recap of the month!

#### August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

#### 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
Top Kudoed Authors