Forum Discussion
Display only related measures or dimensions dynamically in table visual
I have requirement where I need to display columns dynamically in table based on user selection in drop down or slicers
example - I have two slicers in my report , one for selecting Dimension and another for selecting Measures ( created using Field Parameters)
Table should display Profit Margin measure with Product dimension selected however if user select Customer or Date dimension with Profit Margin then it should show nothing because Profi Margin is not related with Customer or Date dimenion
- Anonymous11 months ago
Hi powerbiexpert22 ,
Initially you have mentioned this
"If user select Customer or Date dimension with Profit Margin then it should show nothing because Profi Margin is not related with Customer or Date dimenion"
as per the screenshots you have shared and with the .pbix you have shared the table does notshow any values when the combination of slicer options are selected, isn't this your requirement? Please clarify so that we can try to configure the .pbix as per your needs.
Thank you
11 Replies
- GrowthNatives
Super User
Hi powerbiexpert22 ,
I get that you want to display only related measures or dimensions dynamicallyIdea
Create a lightweight dimension selector and a measure↔dimension mapping table, then expose every report measure through a small wrapper measure that returns the real value only when the selected dimension is valid; otherwise it returns BLANK().
Steps
1. Create a disconnected slicer for Dimension selection
DimSelector = DATATABLE( "Dimension", STRING, { {"Product"}, {"Customer"}, {"Date"} } )Use DimSelector[Dimension] as the slicer users pick.
2. Create a mapping table (which measures are valid for which dims)
MeasureDimensionMap = DATATABLE( "MeasureKey", STRING, "Dimension", STRING, { {"ProfitMargin","Product"}, {"Revenue","Product"}, {"Revenue","Customer"}, {"OrderCount","Customer"}, {"Revenue","Date"} } )
3. Create a wrapper measure for each business measureDisplay_ProfitMargin = VAR selDim = SELECTEDVALUE( DimSelector[Dimension] ) VAR allowed = COUNTROWS( FILTER( MeasureDimensionMap, MeasureDimensionMap[MeasureKey] = "ProfitMargin" && MeasureDimensionMap[Dimension] = selDim ) ) > 0 // If no dimension selected, you may choose to show or hide; below shows when selDim blank RETURN IF( selDim = BLANK() || allowed, [Profit Margin], BLANK() )Put Display_ProfitMargin (not the raw measure) into your Measure field-parameter or table values.
4. Wire wrappers into the Measure Field Parameter
If you already use a Field Parameter that controls which measures appear, replace the entries for measures with their wrapper measures. That way the field parameter continues to control visibility, but content is conditional on the selected dimension.5. User experience / visuals
When the user selects Product the Display_ProfitMargin returns real values.
When they select Customer or Date, the wrapper returns BLANK() → table shows empty cells (effectively “nothing”).
If you want the entire column removed instead of blank cells, you’d need to remove the measure from the parameter dynamically (not natively supported) or use a calculation-group / Tabular Editor approach (advanced).
Optional advanced: hide entire column
- If blanks are not good enough and you must remove the column from view, consider:- A calculation group with SELECTEDMEASURE() logic (Tabular Editor), or
- Programmatic parameter rebuild (Power Query / JSON) — both are advanced and require model-editing tools.
Quick checklist before you finish
- Ensure your wrappers are used everywhere the measure is presented (Parameter, Cards, tooltips).
- Test multi-select on DimSelector — the wrapper logic counts a match per selected dimension (adjust logic if you need ANY vs ALL).
- If the matrix shows headers for blank columns and you want them less visible, apply conditional formatting (font color/opacity) to reduce visual noise.
⭐Hope this solution helps you make the most of Power BI! If it did, click 'Mark as Solution' to help others find the right answers.
💡Found it helpful? Show some love with kudos 👍 as your support keeps our community thriving!
🚀Let’s keep building smarter, data-driven solutions together!🚀 [Explore More]
- powerbiexpert22
Impactful Individual
Hi GrowthNatives ,
I am able to make it working based on your solution however it is displaying blank values for those measures which are not related with selected dimensions, is there a way to hide those measures?
- Praful_Potphode
Super User
Hi powerbiexpert22 ,
You can create a flag measure to control the measure slicer like belowFlag = IF( SELECTEDVALUE('Dimensions'[Dimensions Fields])="'Orders'[Order Date]" && SELECTEDVALUE('Measures 2'[Measures Fields])="'Orders'[profit margin]",1,0 )add this to your measure slicer and add condition Flag is 0.this will not show profit margin when
date is selected(as an example).
Please mark it as resolved once confirmed.
Thanks and Regards,
Praful
- powerbiexpert22
Impactful Individual
Hi Praful_Potphode , this solution is not appropriate considering we have more combination of dimensions and measures so permutation and combination become very large and complex and it will be very complicated DAX expression
- powerbiexpert22
Impactful Individual
Hi GrowthNatives ,
i created a sample power bi report with your solution implemented , it is not working expected , please see below file
https://drive.google.com/file/d/1ZjwAcSfRHM78ZtFkEGXHz1VrD0rCBVRg/view?usp=drive_link
- GrowthNatives
Super User
Hi powerbiexpert22 ,
I currently don’t have access to the reference file you mentioned — could you please share a few screenshots showing:- The relationship view (especially for the slicer and mapping tables).
- The wrapper measure setup you used.
- How the Field Parameter table is connected to the visuals.
That would help me cross-check the structure and setup
In the meanwhile , please check these five common pointsStep 1 – Confirm the slicer table
Go to Data View → DimSelector and confirm it contains only:
Product, Customer, Dateand it has no relationships with any other table.
👉 In Model view, it must stay disconnected
Step 2 – Check your mapping tableOpen MeasureDimensionMap in Data View.
It must have exact text matches for the dimension names in the slicer, e.g.ProfitMargin | Product
Revenue | Product
Revenue | Customer
OrderCount | Customer
Revenue | DateIf the spelling or spacing differs from DimSelector[Dimension], the comparison fails and the wrapper will always return BLANK().
Step 3 – Check your wrapper measure logicUse exactly this pattern (adjust only measure name):
Display_ProfitMargin = VAR selDim = SELECTEDVALUE(DimSelector[Dimension]) VAR allowed = COUNTROWS( FILTER( MeasureDimensionMap, MeasureDimensionMap[MeasureKey] = "ProfitMargin" && MeasureDimensionMap[Dimension] = selDim ) ) > 0 RETURN IF( allowed || ISBLANK(selDim), [Profit Margin], BLANK() )
✅ Tip:
Add a temporary Card visual with selDim = SELECTEDVALUE(DimSelector[Dimension]) just to confirm it returns the slicer’s text (“Product”, “Customer”…).
If it’s blank even after you select something, the slicer is from a different table or disconnected incorrectly.
Step 4 – Use the wrapper in the Field ParameterOpen your Field Parameter table in Data View (it’s the auto-generated parameter table).
Ensure it references Display_ProfitMargin — not [Profit Margin].
If your slicer is still tied to the old field parameter that points to base measures, the wrappers never execute.
Step 5 – Test logic interactivelySelect Product in the slicer → you should see values.
Select Customer or Date → cells go blank.
If still wrong:
Create a test measure:
Debug_Check = "selDim=" & SELECTEDVALUE(DimSelector[Dimension]) & " | allowed=" & IF( COUNTROWS( FILTER( MeasureDimensionMap, MeasureDimensionMap[MeasureKey] = "ProfitMargin" && MeasureDimensionMap[Dimension] = SELECTEDVALUE(DimSelector[Dimension]) ) ) > 0, "TRUE","FALSE" )Drop it in a card and read the text after slicer changes.
- powerbiexpert22
Impactful Individual
- AnonymousNot applicable
Hi powerbiexpert22
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.
Thank you. - HarishKM
Super User
powerbiexpert22 Hey,
I will follow below steps
- I will use below field parameter -
Dimension Field Parameter: Include Product, Customer, and Date dimensions.
Measure Field Parameter: Include Profit Margin and any other relevant measures.2. I will Configure few Slicers:
- Dimension Slicer: Connect the slicer to the Dimension Field Parameter.
- Measure Slicer: Connect another slicer to the Measure Field Parameter.3. Use DAX to create a calculated measure that checks the selection:
DisplayMeasure =
IF(
SELECTEDVALUE(DimensionParameter[Value]) = "Product" &&
SELECTEDVALUE(MeasureParameter[Value]) = "Profit Margin",
[Profit Margin],
BLANK()
)I will above mentioned steps to troubleshoot and solve your problem.
Did it work? ✔ Give a Kudo • Mark as Solution – help others too! - AnonymousNot applicable
May I check if this issue has been resolved? If not, Please feel free to contact us if you have any further questions.
Thank you