Forum Discussion
Create virtual table using Max and Min dates from date prompt
- 5 years ago
Hi GR_Oxnard_STU ,
Pls see the below:
base table:
CALENDAR_DTE = CALENDAR("2021/1/1","2021/6/1")Relationship:
Then use the following measure to create a new table:
Tbl_OPEN_ORDERS = VAR MAXDTE = MAX ( CALENDAR_DTE[Date] ) VAR MINDTE = MIN ( CALENDAR_DTE[Date] ) RETURN CALCULATETABLE ( SUMMARIZE ( 'Table', 'Table'[ordernumber], 'Table'[open date], 'Table'[close date] ), 'Table'[open date] <= MAXDTE && 'Table'[close date] >= MINDTE )Final get the below:
You could adjust the differnet between your dax with my dax.
And about error The expression contains multiple columns, but only a single column can be used in a true/false expression that is used as a table filter expression
the following articles tells:If you need to invoke CALCULATE using more than one column in the condition, you need to use FILTER function, which provides a list of values instead of a condition. Since these two tables are related by the "Matter Number" field, you can use RELATED() function to compare two column values.
Wish it is helpful for you!
Best Regards
Lucien
I tried the selectcolumns approach, but it filters one of the conditions, but not the other. iIt is filtering correctly the order start date <=max(calendar_date), but not the order end date>=min (calendar_date):