Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
reggiebob
Frequent Visitor

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 multi site based on the % value of the ShiptoCityState and date selected. If one ShiptoCityState within a contract has 75% or more of the total sales for the contract that the whole contract would be listed as a single site. If there are no ShiptoCityState's within the contract that hold 75%+ of the sales for that contract the whole contract is Multi Site contract. If the customer is not linked to a contract at all it would be listed as No Contract. If I move the % Value slicer to 60% I would like the SiteSize to update based on the % selected. I would also like to have a slicer to select each of the metrics as well. Any ideas? Thank you in advance for your help!

 

Example:

reggiebob_0-1738082747274.png

I am not able to upload attachments so I've provided the data tables below.

 

Customer table: 

CustomerContractShiptoCityState
1 ChicagoIllinois
21564LincolnNebraska
31946PhoenixArizona
41564LincolnNebraska
51564BismarkNorthDakota
61946LasVegasNevada
71844DallasTexas
81844FortWorthTexas
91844FortWorthTexas
101564AmesIowa

 

Sales Table:

CustomerMonthSales
112/1/202465123
212/1/202431912
312/1/2024987416
412/1/20241984
512/1/202415189
612/1/20241968546
712/1/202411654
812/1/2024984651
912/1/202449843
1012/1/20244864
11/1/2025516854
21/1/202515665
31/1/202516581
41/1/202587241
51/1/20258946
61/1/202576532
71/1/202564352
81/1/202543516
91/1/202531331
101/1/2025465146

% Table: 

% Value
0.00%
5.00%
10.00%
15.00%
20.00%
25.00%
30.00%
35.00%
40.00%
45.00%
50.00%
55.00%
60.00%
65.00%
70.00%
75.00%
80.00%
85.00%
90.00%
95.00%
100.00%

SiteSize Table:

SiteSize
Single Site
Multi Site
No Contract
1 ACCEPTED SOLUTION
MFelix
Super User
Super User

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.

 

MFelix_0-1738086476493.pngMFelix_1-1738086492962.png

 

 

MFelix_2-1738086529563.png

 

Please see attach file.

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





View solution in original post

2 REPLIES 2
MFelix
Super User
Super User

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.

 

MFelix_0-1738086476493.pngMFelix_1-1738086492962.png

 

 

MFelix_2-1738086529563.png

 

Please see attach file.

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





This worked perfectly! Thank you so much for your help. 😁

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.