Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Approximating benchmark line in combo chart

I have a combo chart with 2 axis.  On the bar axis, I have total score, and on the line chart, I have total sales.  I added a "benchmark" value (85%) to the grouped bar chart, but the user wants th...
  • Anonymous's avatar
    Anonymous
    2 years ago

    I was able to figure out a measure applying the max sum by vendor to to each vendor:

     

    MaxAmountByVendor = 
    VAR yearBeginning = DATE(YEAR(MIN('PurchaseInvoiceLine'[PostingDate])), 1, 1)
    VAR periodEnd = MAX('Date'[Date])
    var maxamount = 
    MAXX(
        GROUPBY(
            FILTER(
                ALL('PurchaseInvoiceLine'),
                'PurchaseInvoiceLine'[PostingDate] >= yearBeginning && 'PurchaseInvoiceLine'[PostingDate] <= periodEnd
            ),
            'PurchaseInvoiceLine'[VendorNo],
            "MaxAmount", SUMX(CURRENTGROUP(),'PurchaseInvoiceLine'[Amount])
        ),[MaxAmount]
    )
    return maxamount