Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Problem creating measures in a measure-table

Hi,
 
I have a separate Measure table set up and im trying to create measures there to use in my visuals. For some reason I fail to create a percentage measure, that gives the customer's share of total sales. What am I doing wrong here? Apparently the result is not a single figure.
 
Total sales per customer (works):
 
CustomerShareOfSales = SUMX(
'SalesInvoices',
'SalesInvoices'[TotalSum]
)


Total percentage of sales per customer (does not work):
 
CustomerShareOfSales-% =
Divide([CustomerShareOfSales],ALL('SalesInvoices'[TotalSum]))
  • Anonymous 

    ALL() is a filter function, it's not return any number to divide

    try

     

    Divide(
    [CustomerShareOfSales],
    
    CALCULATE(SUM(SalesInvoices[TotalSum]), ALL(SalesInvoices) )
    )

3 Replies

  • az38's avatar
    az38
    Community Champion

    Anonymous 

    ALL() is a filter function, it's not return any number to divide

    try

     

    Divide(
    [CustomerShareOfSales],
    
    CALCULATE(SUM(SalesInvoices[TotalSum]), ALL(SalesInvoices) )
    )
    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you this works! Do i understand the CALCULATE in this correctly: It creates a new filter context in which the SUM is evaluated in and is therefore mandatory?

      • az38's avatar
        az38
        Community Champion

        Anonymous 

        well,CALCULATE() in this case allows you to evaluate ALL() context as a filter