Forum Discussion

SreejithR's avatar
SreejithR
Frequent Visitor
5 years ago

Dynamic Column selection based on Slicer selection

Hi All,
I am new to power BI and DAX and looking for solution for below issue.
I want to generate a runtime dynamic column based on slicer selection
Sample data as below.

 Opportunity_KeyQuarterMonthRainmakerRainmaker_QrtrRainmaker_MonthTCV
100Q1AprDonaldDonaldDonald250000
172Q1MayJohnSamSunny500000
183Q1MayJohnSamSunny250000
186Q1MayJohnSamSunny2200000
546Q2JunSteveSteveSteve2400000
560Q2JulMarySteveMark200000

 

And the use case as below,

   If user has done any slection on Quarter Slicer, column "Rainmaker_Quarter" to be considered for the dynamic column
   Else if user has done a slection on Month Slicer, column "Rainmaker_Month" to be considered for the dynamic column
   Else column "Rainmaker" to be considered for the dynamic column

 

I am able to write it in a calculated measure like below

MeasureRainmaker = IF(ISFILTERED(pre_sls_tbl[Month]),pre_sls_tbl[Rainmaker_Month],IF(ISFILTERED(pre_sls_tbl[Quarter]),pre_sls_tbl[Rainmaker_Quarter],pre_sls_tbl[Rainmaker]))

But it doesnt look useful for me as I can't put the measure in the X-axis of a bar chart.
Basically my bar chart to show various rainmakers on X axis and curresponding TCV on Y axis depends on the slicer selection.
Can anyone please guide me?

 

thanks

Sreejith

3 Replies