Forum Discussion
JothiG
11 months agoHelper III
dax correction
4_Cur_yr_cost_amt_pur = var SelectedYear = max('yarn data'[Stock_finyear]) var _month_max = CALCULATE(MAX('yarn data'[month_sorter]), FILTER(all('yarn data'), 'yarn data'[Stock_finyear] = Selec...
- 11 months ago
Hi JothiG
Replace your final multiplication with a SUMX that multiplies per row, inside the same filters:
4_Cur_yr_cost_amt_pur = VAR SelectedYear = MAX('yarn data'[Stock_finyear]) VAR _month_max = CALCULATE( MAX('yarn data'[month_sorter]), ALL('yarn data'), 'yarn data'[Stock_finyear] = SelectedYear ) VAR _month = SELECTEDVALUE('yarn data'[month_sorter]) VAR _month_calc = IF( ISBLANK(_month), _month_max, _month ) RETURN CALCULATE( SUMX( 'yarn data', 'yarn data'[Qty] * 'yarn data'[rate] ), 'yarn data'[Stock_finyear] = SelectedYear, 'yarn data'[month_sorter] = _month_calc )
danextian
11 months agoSuper User
Hi JothiG
It seems to me that you are trying to get the product of aggregations for each row and them sum them up. But that's just my guess. There's no enough information to go on with. Please provide a workable sample data (not an image), your expected result from the same sample data and your reasoning behind. You may post a link to Excel or a sanitized copy of your PBIX stored in the cloud. https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523