Search code examples
powerbidaxmeasure

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.


Solution

  • I solve the the problem with the following code.

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

    Thanks.