Ewoud de Boer on 28 Jul 2022 08:38:30
Would be very nice if the result of field parameters could be used in other dax measures.
- Comments (1)
RE: Use field parameters in dax measures
A practical use for this:I have a matrix with field parameters for the rows and columns. The formula that calculates the cell contents would like to see such things as the column total and maximum cell value on a particular measure. The usual way shown in tutorials is to do table manipulation functions, sometimes creating an intermediate summary table.These table manipulation functions cannot directly access the field parameters. There is a workaround for doing column totals:VAR col_name =
MAXX(FILTER('Show',
Show'[Show Order] = SELECTEDVALUE('Show'[Show Order])),
'Show'[Show])
via https://amitchandak.medium.com/switch-topn-with-field-parameters-299a0ae3725fOnce you have the name of the selected parameter, you can then write a SWITCH statement that has the table calculation for each possible selected field. This is already a maintenance nightmare by itself. If multiple columns, or columns and rows at the same time can be selected, then the number of necessary calculations explodes and this method is not practical.A way to use the parameter where you would use another field reference would be a great help. I see that this may cause model problems if a table is returned where it could change its columns. I would be happy with a restriction that the final results of these calculations had to be a value (or a table that cannot change its column signature)