jstraub's avatar
jstraub
New Member
2 years ago
Status:
New

INDIRECT Function equivalent

I would like to be able to reference a column name based on a text variable, using something similar to the INDIRECT function in Excel.


I currently have a measure that selects between different time bins:


Highest Value = SWITCH(

    [Selected Bin],

    "Daily", MAXX( SUMMARIZE( 'data1', 'data1'[Daily], "M-UL", 'Measure Table'[UL] ), 'Measure Table'[UL]),

    "Weekly",MAXX( SUMMARIZE( 'data1', 'data1'[Weekly], "M-UL", 'Measure Table'[UL] ), 'Measure Table'[UL]),

    "Monthly",MAXX( SUMMARIZE( 'data1', 'data1'[Monthly], "M-UL", 'Measure Table'[UL] ), 'Measure Table'[UL]))


but it requires me to predefine the bins and use SWITCH to reference the specific column name in parameter 2 of the SUMMARIZE function.


What would be nice is if you would enable DAX to pass the text value of the measure [Selected Bin] indirectly to replace the individual column names ('data1'[Daily], 'data1'[Weekly], 'data1'[Monthly]) so that a fully dynamic measure would read something like this:


Highest Value No Switch = MAXX( SUMMARIZE( 'data1', INDIRECT([Selected Value], "M-UL", [UL] ), [UL] )


I have searched all the forums I know for a workaround and it just seems like a feature that ought to be included.


Let me know if you have any questions or want to see the PBIX of what I am proposing


Regards

Julian Straub

Recent ideas