Forum Discussion
anna-lee
Helper I
3 years agoHelp creating dax measure
Hi, I am trying to create a measure/column that will calculate: revenue / ((accountsreceivable - year before accountsreceivable) / 2) else 0 and still be relative to the vendor code & year. ...
- 3 years ago
Hi anna-lee
Please create a measure:
Measure = VAR __Year = MAX('Table'[Year]) VAR __Revenue = SUMX(FILTER('Table',[Description] = "revenue" && 'Table'[Vendor Code] = SELECTEDVALUE('Table'[Vendor Code])),[Value]) VAR __AR = SUMX(FILTER('Table',[Description] = "accountsreceivable" && 'Table'[Vendor Code] = SELECTEDVALUE('Table'[Vendor Code])),[Value]) VAR __ARPY = SUMX(FILTER(ALL('Table'),[Description] = "accountsreceivable" && [Year] = __Year - 1 && 'Table'[Vendor Code] = SELECTEDVALUE('Table'[Vendor Code])),[Value]) VAR __Result = DIVIDE(__Revenue, (__AR - __ARPY) / 2) RETURN __ResultThe result in matrix is the same as the result in excel:
Best regards,
Yadong Fang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-yadongf-msft
Community Support
3 years agoHi anna-lee
Please create a measure:
Measure =
VAR __Year = MAX('Table'[Year])
VAR __Revenue = SUMX(FILTER('Table',[Description] = "revenue" && 'Table'[Vendor Code] = SELECTEDVALUE('Table'[Vendor Code])),[Value])
VAR __AR = SUMX(FILTER('Table',[Description] = "accountsreceivable" && 'Table'[Vendor Code] = SELECTEDVALUE('Table'[Vendor Code])),[Value])
VAR __ARPY = SUMX(FILTER(ALL('Table'),[Description] = "accountsreceivable" && [Year] = __Year - 1 && 'Table'[Vendor Code] = SELECTEDVALUE('Table'[Vendor Code])),[Value])
VAR __Result = DIVIDE(__Revenue, (__AR - __ARPY) / 2)
RETURN
__Result
The result in matrix is the same as the result in excel:
Best regards,
Yadong Fang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
anna-lee
Helper I
3 years agov-yadongf-msft
this worked perfectly. thank you!