Forum Discussion
Need help urgently match
Date(m/d/year) Order id
1/5/2020 1
1/6/2020 2
1/7/2020 3
2/6/2020 1
2/6/2020 2
2/6/2020 4
3/6/2020 3
3/6/2020 5
3/6/2020 6
when I select the Feb I should get this output
Date(m/d/year) Order id Flag
2/6/2020 1 1
2/6/2020 2 1
2/6/2020 4 0
when I select the March I should get this output
Date(m/d/year) Order id Flag
3/6/2020 3 1
3/6/2020 5 0
3/6/2020 6 0
the output will be "1" if the order id is present in the previous month. Thank you
The measure I suggested above should work. If you want a calculated column:
Flag = VAR currentOrder_ = Table1[Order id] VAR limit_ = EOMONTH ( Table1[Date(m/d/year) ] , -1 ) RETURN CALCULATE ( COUNT ( Table1[Order id] ), Table1[Order id] = currentOrder_, Table1[Date(m/d/year) ] <= limit_, ALL ( Table1 ) ) + 0Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
11 Replies
- AlB
Community Champion
The measure I suggested above should work. If you want a calculated column:
Flag = VAR currentOrder_ = Table1[Order id] VAR limit_ = EOMONTH ( Table1[Date(m/d/year) ] , -1 ) RETURN CALCULATE ( COUNT ( Table1[Order id] ), Table1[Order id] = currentOrder_, Table1[Date(m/d/year) ] <= limit_, ALL ( Table1 ) ) + 0Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
- qwaiti27231
Helper III
i wanted calculated column
- amitchandak
Super User
qwaiti27231 , Try a new measure like
if(isblank(countx(filter(all(Table), table[date] > eomonth(max(Table[date]),-2) && table[date] <= eomonth(max(Table[date]),-1) && table[Order id] =max(Table[Order id])),[Order Id])),0,1)- qwaiti27231
Helper III
amitchandak its not working
- amitchandak
Super User
- amitchandak
Super User
qwaiti27231 , replies are nested, check my last replay with file. Two measures added into the file
- AlB
Community Champion
Hi qwaiti27231
Previous month or previous monthS?? Your talk about the former but your example shows the latter. For the latter option:
Flag = VAR currentOrder_ = SELECTEDVALUE ( Table1[Order id] ) VAR limit_ = EOMONTH ( SELECTEDVALUE ( Table1[Date] ), -1 ) RETURN CALCULATE ( COUNT ( Table1[Order id] ), Table1[Order id] = currentOder_, Table1[Date] <= limit_, ALL ( Table1 ) )Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
- qwaiti27231
Helper III
AlB previous months