Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
mrzain14
Frequent Visitor

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

2 ACCEPTED SOLUTIONS
Daniel29195
Super User
Super User

@mrzain14 

 

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! 🤠

View solution in original post

@mrzain14 

 

you wrote var.s( 

modify it  to :  var S =  

 

 

 

View solution in original post

4 REPLIES 4
Daniel29195
Super User
Super User

@mrzain14 

 

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! 🤠

mrzain14_0-1707184239126.png

Hi @Daniel29195 , I still got error like this

@mrzain14 

 

you wrote var.s( 

modify it  to :  var S =  

 

 

 

Thank you

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.