Sk Abid Ahmed
Sk Abid Ahmed

Reputation: 11

How to get last working date in DAX Power BI

I have a calendar table as below

Calendar Table

I want to get the last working date based on DayType. Here H=Holiday and W=Working Day

So, I create a measure as follows

LastWorkingDay = CALCULATE(LASTDATE(RollingCalender_LookUp[Date]), FILTER(RollingCalender_LookUp,RollingCalender_LookUp[DayType]="W"))

But it did not give me the correct result. The measure gives me Blank. Can you please tell me the mistake I did here. Thanks.

Upvotes: 1

Views: 3156

Answers (1)

Sk Abid Ahmed
Sk Abid Ahmed

Reputation: 11

I solve the the problem with the following code.

LastWorkingDay = CALCULATE(MAX(RollingCalender_LookUp[Date]), FILTER(ALL(RollingCalender_LookUp),RollingCalender_LookUp[DayType]="W"))

Thanks.

Upvotes: 0

Related Questions