Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I need help with some DAX. I have a working DAX that counts open orders. I am wanting to adjust this DAX to calculate total sales for open orders. I am not sure why it won't calculate. Here is the working version:
Solved! Go to Solution.
Reading the code, it looks like you are picking the date and wanting to sum the 'OB Raw Order Data'[ACT_MATERIAL_COST] where the 'OB Raw Order Data'[CREATE_DATE] is on or before the date and the 'OB Raw Order Data'[Order Closed Date] is > the 'tbl_Calendar'[End Of Month] or it is blank.
Give this measure a try and see if it is what you are looking for.
OB USB =
VAR _Date = MIN ( 'tbl_Calendar'[Date] )
VAR _EoM = MIN ( 'tbl_Calendar'[End Of Month] )
RETURN
CALCULATE (
SUM ( 'OB Raw Order Data'[ACT_MATERIAL_COST] ),
'OB Raw Order Data'[CREATE_DATE] <= _Date,
( 'OB Raw Order Data'[Order Closed Date] > _EoM || ISBLANK ( 'OB Raw Order Data'[Order Closed Date] ) )
)
Reading the code, it looks like you are picking the date and wanting to sum the 'OB Raw Order Data'[ACT_MATERIAL_COST] where the 'OB Raw Order Data'[CREATE_DATE] is on or before the date and the 'OB Raw Order Data'[Order Closed Date] is > the 'tbl_Calendar'[End Of Month] or it is blank.
Give this measure a try and see if it is what you are looking for.
OB USB =
VAR _Date = MIN ( 'tbl_Calendar'[Date] )
VAR _EoM = MIN ( 'tbl_Calendar'[End Of Month] )
RETURN
CALCULATE (
SUM ( 'OB Raw Order Data'[ACT_MATERIAL_COST] ),
'OB Raw Order Data'[CREATE_DATE] <= _Date,
( 'OB Raw Order Data'[Order Closed Date] > _EoM || ISBLANK ( 'OB Raw Order Data'[Order Closed Date] ) )
)
You need to change the field from [Date] to the whatever the field is that has the amounts you are trying to add up.
@jdbuchanan71 Thank you, that is getting me one step closer! I have made these changes, but it seems my SUMX either in my Var or in my Return are causing the totals to calculate incorrectly. Any thoughts on how to fix?
Oh, you are telling it to look at the [Date] field in the earlier step.
Change the formatting of the measure.
Maybe I am missing something but it will not allow me to change the format
Try it with a SUMX over the tmpTable3
OB USD =
VAR tmpdollars =
ADDCOLUMNS (
'OB Raw Order Data',
"Effective Date", IF ( ISBLANK ( [Order Closed Date] ), TODAY (), [Order Closed Date] )
)
VAR tmpTable2 =
SELECTCOLUMNS (
FILTER (
GENERATE ( tmpdollars, 'tbl_Calendar' ),
AND (
( [Date] >= [CREATE_DATE] )
&& ( [Date] <= [Effective Date] ),
OR (
( [Order Closed Date] >= [End Of Month] ),
ISBLANK ( [Order Closed Date] )
)
)
),
"ID", [ACT_MATERIAL_COST],
"Date", [Date]
)
VAR tmpTable3 =
GROUPBY ( tmpTable2, [ID], "@Sum", SUMX ( CURRENTGROUP (), [Date] ) )
RETURN
SUMX ( tmpTable3, [@Sum] )
It is formatting it as a date now. Not sure why, the working DAX for open tickets formatted it as a whole number. @jdbuchanan71
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!