Forum Discussion
Filter table dynamicaly on dates
- 8 years ago
Renco wrote:
With an OData connection or any other 'import' connection this works like a charm. However with a DirectQuery connection this solution is not possible.
So if someone knows another way to achieve this goal, suitable for a DirectQuery connection, I'm looking forward to hearing it.
Thanks in advance.
In DirectQuery mode, say if the data source is SQL Server, you can create the columns in SQL instead of in Power BI desktop. Then you can still apply filter to the true/false column.
This works:
New Column in modelling tab:
Datum = CALCULATE(LASTDATE(Klantenprijsgroep_Sheet[Begindatum]);ALLEXCEPT(Klantenprijsgroep_Sheet;Klantenprijsgroep_Sheet[Artikelnr.]);Klantenprijsgroep_Sheet[Begindatum]<=TODAY())
With another column:
Rapportage = IF(Klantenprijsgroep_Sheet[Begindatum]=Klantenprijsgroep_Sheet[Datum];true();false())
And filtering in the visual itself on 'true'.
Perhaps there is a better way than this but at least it's a solution
- Eric_Zhang8 years agoMicrosoft Employee
The solution is elegant, for me, I'll take the same solution.
- Renco8 years agoAdvocate II
With an OData connection or any other 'import' connection this works like a charm. However with a DirectQuery connection this solution is not possible.
So if someone knows another way to achieve this goal, suitable for a DirectQuery connection, I'm looking forward to hearing it.
Thanks in advance.
- Eric_Zhang8 years agoMicrosoft Employee
Renco wrote:
With an OData connection or any other 'import' connection this works like a charm. However with a DirectQuery connection this solution is not possible.
So if someone knows another way to achieve this goal, suitable for a DirectQuery connection, I'm looking forward to hearing it.
Thanks in advance.
In DirectQuery mode, say if the data source is SQL Server, you can create the columns in SQL instead of in Power BI desktop. Then you can still apply filter to the true/false column.