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!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hello Dear community,
I have column of sales,
[Quantity] [Client name] [Date]
I need DAX function to sum quantity
SUM [Quantity]
IF [Date] < Current row
and Client name = Current row
It could be something like this in Excel:
Sumifs(Quantity,[Client name],A10,[Date],"<"&C10,..)
Can anybodyhelp me please to solve this problem?
Solved! Go to Solution.
Thank you very much for fast reply.
I tried your solution. But my full function is like this
Hi @Akbarov
for a calculated column please use
=
VAR CurrentDate = TableName[Date]
RETURN
CALCULATE (
SUM ( TableName[Quantity] ),
TableName[Date] < CurrentDate,
ALLEXCEPT ( TableName, TableName[Client name] )
)
For measure use
=
CALCULATE (
SUM ( TableName[Quantity] ),
TableName[Date] < MAX ( TableName[Date] )
)
Hi @tamerj1, I don't understand how this could work as the date will always be inferior to current date hence your formula seems like it would always give the sum of the entire Quantity column. Could you explain ?
Hi @Nacci11
CurrentDate is tye Date of the current row under iteration.
CALCULATETABLE- ALLEXCEPT will produce a table that represent all the rows of the current client. This table is filtered for every row in the original table for ClientTable.Date < OriginalTable.Date
@Akbarov ,
A new column = sumx(filter(Table, [Client] =earlier([Client]) && [Date] < earlier([Date]) ), [Quantity])
or
A new Measure = sumx(filter(allselected(Table), [Client] =max([Client]) && [Date] < max([Date]) ), [Quantity])
Thank you very much for fast reply.
I tried your solution. But my full function is like this
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.