field
1 Topicusing field parameter inside a measure
Hi there, It is possible to use a field parameter inside a measure? I have a report where I display in a line chart different moving averages for one specific column (DJM). Each line is drawn using a measure (5 in total), and the users can select which line(s) to show using a slicer. I also allow the users to specify how many periods they want to use for a moving average. To do so I used a numeric parameter that I include in one of the measures (SMA #) like this: SMA (# weeks) = AVERAGEX( DATESBETWEEN(Carro[Date],MAX(Carro[Date]) - (prmMA[prmMA_value]-1)*7, MAX(Carro[Date])), CALCULATE(SUM(Carro[DJM])) ) This report works perfectly for just one data column (DJM), but if I want display the same line chart for a different data column I must create another 5 measures for that new/different data column. The problem is that I have around 20 columns and I do not wish to create 100 measures... I tried to use the field parameter the same way I have used the numeric parameter, trying to replace in the measures Carro[DJM] for prmField[prmField Opt], but if I click to display this line/measure, the chart shows a display error (SUM does not admit strings). SMA (5 weeks) = AVERAGEX( DATESBETWEEN(Carro[Date],MAX(Carro[Date]) - (5-1)*7, MAX(Carro[Date])), CALCULATE(SUM(prmField[prmField Opt])) ) PS: I could no tfind how to upload here my pbix file. Please use this link or check the pictures below: https://we.tl/t-mFnePxOlwp Thanks a lot for any help you might provide!Solved3KViews0likes3Comments