Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
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
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 4 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 25 | |
| 17 | |
| 8 | |
| 8 | |
| 7 |