Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Using * -1 with a Dax measure

Power BI Community Good Day!   The Dax below is giving me a positive value. What do I have to do to modify the Dax with * -1 to make it a negative value?   Net Timing = CALCULATE(SUM(metricssale...
  • Samarth_18's avatar
    4 years ago

    Hi Anonymous ,

     

    You can try below code:-

    Net Timing =
    VAR result =
        CALCULATE (
            SUM ( metricssalescustomer[amount] ),
            metricssalescustomer[sales_type_lvl1] = "Lost - Timing"
                || metricssalescustomer[sales_type_lvl1] = "Decline - Timing"
                || metricssalescustomer[sales_type_lvl1] = "Upsell - Timing"
                || metricssalescustomer[sales_type_lvl1] = "New - Timing"
        )
    RETURN
        result * -1

     

    Thanks,

    Samarth

  • AlexisOlson's avatar
    4 years ago

    You can just stick a "-" in from of CALCULATE or SUM too but you may want to keep more visible than just a single character.

     

    I'd probably do something like this:

    Net Timing =
    CALCULATE (
        -1 * SUM ( metricssalescustomer[amount] ),
        metricssalescustomer[sales_type_lvl1]
            IN { "Lost - Timing", "Decline - Timing", "Upsell - Timing", "New - Timing" }
    )