cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper V
Helper V

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

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

Putting square pegs in round holes since 1972.

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

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

Putting square pegs in round holes since 1972.

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!!
My Recent Blog -Week is not so Weak Connect on Linkedin

Proud to be a Super User!

Helpful resources

Announcements
Meet the 2020 Season 2 Power BI Super Users!

Meet the 2020 Season 2 Power BI Super Users!

Find out who's part of the program this season, and welcome the new Super Users.

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

July 2020 Community Highlights

July 2020 Community Highlights

Learn about the exciting things that happened in July.

Featured Data Story of The Month

Featured Data Story of The Month

All Data Stories Gallery contributions are reviewed for each month. We select a contribution and feature the community member the following month.

Power BI Dev Camp - Developing with .NET Core

Power BI Dev Camp - Developing with .NET Core

Learn how to develop custom web applications for Power BI using .NET Core 3.1 and .NET 5.

Top Solution Authors
Top Kudoed Authors