cancel
Showing results 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
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)

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

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

Proud to be a Super User!

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

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

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

Proud to be a Super User!

Highlighted
Super User IX

## Re: CALCULATE with LASTDATE

@Pikachu-Power , try like

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

Proud to be a Super User!