Forum Discussion
Parameters and slicers
- Anonymous2 years ago
Hi Anonymous ,
As far as I know, dynamic M query parameters only supports to Direct Query connection mode. So if you use Direct Query connection to connect to your data source it is a good choice.
If you use import connection mode, here I suggest you to try measure by DAX.
Firstly, we need to create an unrelated Dimstatus table and an unrelated Calendar table to help calculation.
DimStatus = DATATABLE( "Status",STRING, "Order",INTEGER, { {"Active",1}, {"Inactive",2} } )Calendar = CALENDARAUTO()Measure:
MEASURE = VAR _RangeStart = MIN ( 'Calendar'[Date] ) VAR _RangeEnd = MAX ( 'Calendar'[Date] ) VAR _Roweffstart = MAX ( 'Table'[roweffstart] ) VAR _Roweffend = MAX ( 'Table'[roweffend] ) VAR _CurrentStatus = IF ( AND ( _Roweffstart <= _RangeEnd, OR ( _Roweffend >= _RangeStart, _Roweffend = BLANK () ) ), "Active", "Inactive" ) VAR _result = IF ( _CurrentStatus = MAX ( DimStatus[Status] ), 1, 0 ) RETURN _resultAdd this measure into value field and set it to show items when value =1. Result is as below.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous you need to use dynamic M query parameters, read all about it here. Dynamic M query parameters in Power BI Desktop - Power BI | Microsoft Learn