Forum Discussion
Sam09
7 years agoFrequent Visitor
dynamically changing the column display based on slicer selection..
Is it possible to dynamically change the columns which i'm showing in the table visualization based on the option selected in the slicer. I have the below table: MobID Pname level Model
...
Sam09
7 years agoFrequent Visitor
AkhilAshok - Awesome, now the table is created with values in it (Prod2016,Prod2017,Prod2018), but how to do the below logic part, the measure(Values in previous Year ) created by v-yulgu-msft in the suggested answers above..:
SELECTEDVALUE ( SlicerTable[model] ) - 1
AkhilAshok
7 years agoSolution Sage
After giving some thought into this, you could do it following way:
1. The SQL for your Model slicer table should be as below:
SELECT 'Prod2016' AS model, 2016 AS year UNION ALL SELECT 'Prod2017', 2017 UNION ALL SELECT 'Prod2018', 2018
2. Create the following Measures:
Record # = COUNTROWS(ProdData)
Count Selected Year =
VAR selectedModel =
SELECTEDVALUE ( 'Model'[model] )
RETURN
CALCULATE ( [Record #], ProdData[model] = selectedModel )
Count Previous Year =
VAR PrevYear =
SELECTEDVALUE ( 'Model'[year] ) - 1
VAR PrevYearModelTbl =
FILTER ( ALL ( 'Model' ), 'Model'[year] = PrevYear )
VAR PrevYearModel =
MAXX ( PrevYearModelTbl, 'Model'[model] )
RETURN
CALCULATE ( [Record #], ProdData[model] = PrevYearModel )Let me know if it works.