Forum Discussion

JadeDoherty's avatar
JadeDoherty
Regular Visitor
5 years ago
Solved

Need assistance with DAX Measure

Hello - wondering if someone might be able to assist with a DAX Measure / Calculation.   Basically the sales team is looking to run a Sales promotion that will be based on a points system - where p...
  • mahoneypat's avatar
    5 years ago

    Here is a measure expression that gets your desired results in a table visual with the SalesRep column.

     

    Promotion Points =
    SUMX (
        VALUES ( SalesData[Customer] ),
        VAR hammers =
            CALCULATE (
                COUNT ( SalesData[Date] ),
                SalesData[Team] <> "Wholesale",
                SalesData[Product] = "Hammer"
            )
        VAR bolts =
            CALCULATE (
                COUNT ( SalesData[Date] ),
                SalesData[Team] <> "Wholesale",
                SalesData[Product] = "Bolt"
            )
        VAR hammerpoints =
            IF (
                hammers > 3,
                3,
                hammers
            )
        VAR boltpoints =
            IF (
                bolts * 2 > 10,
                10,
                bolts * 2
            )
        RETURN
            hammerpoints + boltpoints
    )

     

     

    Regards,

    Pat