Forum Discussion
Measure: Text & Date
Hi all,
I have two tables:
- 'Merge1'
- 'Export Actions'
I need a measure which:
- If CandidateRef in Merge1 has a Export Actions[ActionName] = "Call - Update"
- & 'Export Actions'[ActionDate] >= Latest Monday
- THEN Yes
Latest Monday returning only actions from the most recent monday onwards
Hope that's clear and thanks again!
Merge 1 table
Export Actions
Hi HenryJS
Check if this result is ok.
To get this, I create a date table
date table = ADDCOLUMNS ( CALENDARAUTO (), "year", YEAR ( [Date] ), "month", MONTH ( [Date] ), "week", WEEKNUM ( [Date], 2 ), "weekday", WEEKDAY ( [Date], 2 ) )Then Create measures
name = LOOKUPVALUE ( 'Export Candidates'[Candidate Name], 'Export Candidates'[CandidateRef], MAX ( 'Export Actions'[CandidateRef] ) ) lastMonday = CALCULATE ( MAX ( 'date table'[Date] ), FILTER ( ALL ( 'date table' ), 'date table'[weekday] = 1 && 'date table'[Date] <= TODAY () ) ) Contacted Since Monday = IF ( [name] <> BLANK () && MAX ( [action.date] ) <= [lastMonday] && MAX ( [ActionName] ) = "Call - Update", "Yes", "No" ) Contact By = IF([Contacted Since Monday]="Yes",MAX([UserName])) Contacted on = IF([Contacted Since Monday]="Yes",MAX([ActionDate]))[action.date] is a calculated column
action.date = [ActionDate].[Date]Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 Replies
- Greg_Deckler
Community Champion
Should be fairly easy, sample data as text please. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
- HenryJS
Post Prodigy
Hi Greg_Deckler
I need three columns/measures (not sure which ones more applicable)
Contacted Since Monday
- If 'Export Candidates'[CandidateRef] = 'Export Actions'[CandidateRef]
- & 'Export Actions'[ActionDate] >= Latest Monday onwards
- & 'Export Actions'[ActionName] = "Call - Update"
- THEN "Yes"
Contact By
- If 'Contacted Since Monday' = "Yes"
- RETURN 'Export Actions'[Username] for latest Action
Contacted on
- If 'Contacted Since Monday' = "Yes"
- RETURN 'Export Actions'[ActionDate] for latest Action
'Export Actions'
CandidateRef Candidate UserName ActionName ActionDate 38731 Jason Repeti Penelope Ware Call - Update 06/04/2020 18:26 90770 Victor Kingsley Penelope Ware Call - Update 06/04/2020 18:21 65631 John Lawrence Henry Penelope Ware Call - Update 06/04/2020 18:19 39445 Adrian Stuart Katherine Brophy Call - Update 06/04/2020 16:19 110032 Jay Atie Izabela Mylak Call - Update 06/04/2020 16:19 'Export Candidates'
CandidateRef Candidate Name 38731 Jason Repeti 180 Simon Parsons 242 John Harris 243 Tim Kirkby 244 Mick Sawford 245 Chris Overton 246 Peter Begbey 247 Paul Mankey 90770 Victor Kingsley 249 Roger Halsey 250 Mark Emberton 251 Les Darrall 252 Derek Jones 253 Phil Thompson Hope that makes sense
Thank you!
- v-juanli-msft
Community Support
Hi HenryJS
Check if this result is ok.
To get this, I create a date table
date table = ADDCOLUMNS ( CALENDARAUTO (), "year", YEAR ( [Date] ), "month", MONTH ( [Date] ), "week", WEEKNUM ( [Date], 2 ), "weekday", WEEKDAY ( [Date], 2 ) )Then Create measures
name = LOOKUPVALUE ( 'Export Candidates'[Candidate Name], 'Export Candidates'[CandidateRef], MAX ( 'Export Actions'[CandidateRef] ) ) lastMonday = CALCULATE ( MAX ( 'date table'[Date] ), FILTER ( ALL ( 'date table' ), 'date table'[weekday] = 1 && 'date table'[Date] <= TODAY () ) ) Contacted Since Monday = IF ( [name] <> BLANK () && MAX ( [action.date] ) <= [lastMonday] && MAX ( [ActionName] ) = "Call - Update", "Yes", "No" ) Contact By = IF([Contacted Since Monday]="Yes",MAX([UserName])) Contacted on = IF([Contacted Since Monday]="Yes",MAX([ActionDate]))[action.date] is a calculated column
action.date = [ActionDate].[Date]Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.