Forum Discussion
Reference measure in another calculation
I have a measure which simply switches values depending on which currency is selected as bottom query, how do I calculate a percentage of this value, or reference NSV in any other measure? Say for example below, thanks.
% of NSV =
SUM ( [NSV] )
/ CALCULATE (
SUM ( [NSV] ),
ALL ( '30 Product'[Product] )
)
NSV =
VAR _AccountingCurrencyCalculation =
SUM ( '01 Sales Invoice'[NSV_AccountingCurrency] )
VAR _ReportingCurrencyCalculation =
SUM ( '01 Sales Invoice'[NSV_ReportingCurrency] ) // if a currency is selected it will use that otherwise it will default to reporting currency
VAR _Currency =
SELECTEDVALUE ( 'Currency Selection'[Choose Currency], "Reporting Currency" )
RETURN
IF (
_Currency = "Accounting Currency",
_AccountingCurrencyCalculation,
_ReportingCurrencyCalculation
)
This was close however I needed to use calculate as SUM wouldn't work and filter by whole product table not referencing a column.
% of NSV = DIVIDE( [NSV] , CALCULATE ( [NSV] , ALL ('30 Product' )))
4 Replies
- PhilipTreacySuper User
Hi jhowe1
I'm not sure what your data looks like but assuming '30 Product'[Product] contains numbers try this
% of NSV = DIVIDE( [NSV] , SUM ( ALL ( '30 Product'[Product] )))[NSV] is already a SUM of values so you don't need to do it again.
If this doesn't work please supply some sample data so I can see your table structure.
Regards
Phil
- jhowe1Helper III
This was close however I needed to use calculate as SUM wouldn't work and filter by whole product table not referencing a column.
% of NSV = DIVIDE( [NSV] , CALCULATE ( [NSV] , ALL ('30 Product' )))
- PhilipTreacySuper User
Hi jhowe1
I'm not really clear on the problem. You've created a measure called NSV and you want to know how to reference that in another measure? Exactly as you have e.g.
SomeMeasure = DIVIDE( [NSV] , 1)Regards
Phil
- jhowe1Helper III
Thanks for the response, I cannot do below it says 'parameter is not the correct type' and errors. I can only sum physical column, not measure.
% of NSV =SUM ( [NSV] )/ CALCULATE (SUM ( [NSV] ),ALL ( '30 Product'[Product] ))