Forum Discussion

carlol's avatar
carlol
Resolver I
4 years ago

Default filter

I have RLS implemented 

The issue is for a user with all Access , I do not want to illustrate a graph with all options , too busy 

 

My Solution is to idenify the min ID assocaited with the Filter , have a generic name "Default" ; regardless of the options avaialble , it will always illustrate Default option based on what the user has access to 

 

I am struggling with implemation Step 2 , assigning the min ID in the list with default ; the dax treats each value on there own merit versus returing the min ID from the list 

 

Example

Out of all countries the User only has access to the below (User depending this list is dynamic)

 

List 

1 Germany

2 Italy

3 France

4 USA 

5 China

 

Min Value here 1 : I want to assign Germany a Country name of , "Default"  and the other countries in the list the Country Name 

 

Step 1 : In realtime , based on options avaialbe return min ID so we can assign value of Default  

 

HospIDMin = Min( DimHospital[HospID] )
 
 Result is 1 , Germany

 

Step 2 : Assign min ID value Default 

 

HospSlicer =
 
VAR HospIDMax =
CALCULATE(
Min( DimHospital[HospitalID] ) ,
FILTER( DimHospital, DimHospital[HospitalID] <> DimHospital[HospIDMin] )
)
 
VAR _M =
Min( DimHospital[HospitalID] )
RETURN
IF( _M <> HospIDMax, "Default", _M )

 

Expected Result 

1 Default

2 Italy

3 France

4 USA 

5 China

 

2 Replies

  • carlol , As of now default selection can not be dynamic.  Even if we want min or max value in the column, I doubt that will help in this case.

    • carlol's avatar
      carlol
      Resolver I

      Thanks , taught this might be the case 

       

      Worse case I can set to a hardcoded default and if the user falls outside this , message pop up to prompt the user to make a selection 

       

      If anybody else has any work arounds to implement a dynamic seletion please post up