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(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")
 
Much appreciate your time
 
Thank you
 
 
  • 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

  • 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" }
    )

4 Replies

  • Samarth_18's avatar
    Samarth_18
    Icon for Community Champion rankCommunity Champion

    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

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Samarth

      Got it to work, much appreciate your help!

      Thank you

      I notice you are a Memorable Member, what does that mean?

  • 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" }
    )
    • Anonymous's avatar
      Anonymous
      Not applicable

      Hello Alexis

      Will give it a try. 

      Thank you