Forum Discussion

reggiebob's avatar
reggiebob
Frequent Visitor
1 year ago
Solved

Dynamic field based on subset

Hello,   I am hoping someone can help me with what I am trying to accomplish.   Please see my example below. I would like to display a column that indicates if the Contract is single site or mult...
  • MFelix's avatar
    1 year ago

    Hi reggiebob ,

     

    Add the following measures to your model:

     

    Location % = 
                DIVIDE(
    			SUM(Sales[Sales]),
    			CALCULATE(
    				SUM(Sales[Sales]),
    				REMOVEFILTERS(Customer[ShiptoCityState])
    			)
    		)
    
    
    
    Site size = 
            SWITCH(
    			TRUE(),
    			SELECTEDVALUE(Customer[Contract]) = BLANK(), "No Contract",
    			MAXX(
    				ALLSELECTED(Customer[ShiptoCityState]),
    				[Location %]
    			) >= MIN('% Table'[% Value]), "Single Site",
    			"Multi Site"
    		)
    
    Filter by site size = IF([Site size] in VALUES('Site size'[SiteSize]), 1)

     

    Use the measures on your visuals and the Filter by size should be placed on the filter pane for the specific visual with the option is not blank.

     

     

     

     

    Please see attach file.