Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Help to define Dax Formula

Hello,

 

I'm pretty new to using Dax in PowerBI,

I would like to calculate the remaining production qty by calculating (SUM order qty (table 1)) - (SUM production output(table 2)).

rules if the result <0, will be stored as "0" avoid minus.

 

What Dax formula do I need to use?

 

Thank you

  • Anonymous 

     

    measure   = 

    var s = sum(table_1[order qty_col_name]) - sum(table_2[production_output_col_name])

    return

    switch(

    true(), 

    s < 0 , 0 , s)

     

     

    let me know if this works for you . 

     

     

    If my answer helped sort things out for you, i would appreciate a thumbs up πŸ‘ and mark it as the solution βœ…
    It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🀠

  • Anonymous 

     

    you wrote var.s( 

    modify it  to :  var S =  

     

     

     

4 Replies

  • Daniel29195's avatar
    Daniel29195
    Community Champion

    Anonymous 

     

    measure   = 

    var s = sum(table_1[order qty_col_name]) - sum(table_2[production_output_col_name])

    return

    switch(

    true(), 

    s < 0 , 0 , s)

     

     

    let me know if this works for you . 

     

     

    If my answer helped sort things out for you, i would appreciate a thumbs up πŸ‘ and mark it as the solution βœ…
    It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🀠

      • Daniel29195's avatar
        Daniel29195
        Community Champion

        Anonymous 

         

        you wrote var.s( 

        modify it  to :  var S =