Forum Discussion
New Table: Columns from Dates
Hi all,
I need to create a new table.
I have table 1 (below). This would then be used via a measure/calculation to create the table 2 below.
i.e. the dates specified in table 1 would create a "yes" if the week column in table 2 falls within this date range.
Is this possible?
1. Original table with dates
| Tempname | START.DATE | END.DATE |
| Tran Peter | 04/11/2019 | 26/04/2020 |
| Lewis Michael | 09/03/2020 | 28/02/2021 |
| Konior Beata | 21/10/2019 | 29/03/2020 |
| Jarrous Nicholas | 29/02/2020 | 22/06/2020 |
| Whitehead Thomas | 16/07/2019 | 26/04/2020 |
| Reddy Anthony | 04/11/2019 | 26/04/2020 |
| Hernandez Andres | 10/02/2020 | 02/07/2020 |
| Abroud Mehdi | 29/07/2019 | 31/07/2020 |
| Turner Joseph | 17/06/2019 | 05/04/2020 |
2. Table required
| Tempname | Week 40 | Week 41 | Week 42 | Week 43 | Week 44 | Week 45 | Week 46 | Week 47 | Week 48 | Week 49 |
| Tran Peter | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Lewis Michael | ||||||||||
| Konior Beata | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Jarrous Nicholas | Yes | Yes | ||||||||
| Whitehead Thomas | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Reddy Anthony | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Hernandez Andres | Yes | Yes | Yes | Yes | ||||||
| Abroud Mehdi | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Turner Joseph | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
Hi HenryJS .
Add a calendar table with a WeekNumber column then add the following measure to your model:
Active= IF ( SELECTEDVALUE ( 'Table'[START.DATE] ) <= MAX ( 'Calendar'[Date] ) && SELECTEDVALUE ( 'Table'[END.DATE] ) >= MAX ( 'Calendar'[Date] ); "Yes"; "" )Now use the Date column on your matrix column and the names on the lines, use the measure created as values.
Check PBIX file attach.
6 Replies
- MFelix
Super User
Hi HenryJS .
Add a calendar table with a WeekNumber column then add the following measure to your model:
Active= IF ( SELECTEDVALUE ( 'Table'[START.DATE] ) <= MAX ( 'Calendar'[Date] ) && SELECTEDVALUE ( 'Table'[END.DATE] ) >= MAX ( 'Calendar'[Date] ); "Yes"; "" )Now use the Date column on your matrix column and the names on the lines, use the measure created as values.
Check PBIX file attach.
- MFelix
Super User
HI HenryJS ,
I just did a simple format of the week, you can changed it to any format you need, the only question the is needed is that the days in that week column all have the same data so it can be comparable.
Assuming WC format is the first day of that week? (Sorry for the question but not used to this formating syntax of WC)
- amitchandak
Super User
HenryJS ,
Try these measures with a date table having a week. I am sharing a link one example file for the date table
Measure =
if(calculate(count(Date[Date]),filter(Table,Table[start_date]<=max(Date[Week Start]) && Table[end_date]>=max(Date[Week Start])))>0, "Yes","No")
Measure =
if(calculate(count(Date[Date]),filter(Table,Table[start_date]<=max(Date[Date]) && Table[end_date]>=max(Date[Date])))>0, "Yes","No")refer Date table in https://www.dropbox.com/s/d9898a48e76wmvl/sales_analytics_weekWise.pbix?dl=0