Forum Discussion
Macc-PA
5 years agoHelper I
filtering rows using dates from another table
I am new to powerbi and DAX. I am struggling with how todo the following: I have a packages table which has a shipped date and a received date for each package. I have a calendar which is used...
- 5 years ago
My relationship between transit and dates tables is:
Because there is a relationship between the tables, I had to do the following so that it didnt use the relationship to calculate the measure you'd suggested.
PackageInTransit2 =
CALCULATE(
IF( MAX(Transit2[Date Shipped] ) <= [SelectedMonth2]
&& MAX(Transit2[Date Recv] ) > [SelectedMonth2]
/* Then */ , 1
/* Else */ , IF( MAX(Transit2[Date Recv]) = [SelectedMonth2]
/* Then */ , 2
/* Else */ , 0
)
),
CROSSFILTER ( ZMyCalendar[Date], Transit2[Date Recv], NONE )
)SelectedMonth2 = SELECTEDVALUE( ZMyCalendar[MonthInCalendar] )
The result is as below showing what has been delivered in april and what is outstanding
Thank you Dedmon
amitchandak
5 years agoSuper User
Macc-PA ,
countx(filter(packages, packages[shipDate] <= max(Date[Date]) && packages[recvDate ] > max(Date[Date])),packages[ID])
Both shipDate and recvDate join to date table . for above formula , the should be joined so use crossfilter
refer