Forum Discussion
Sofiane85
2 years agoFrequent Visitor
sales from different dates range
Hi all,
i have 2 tables, "Sales" and "Target"
in the Target table there is some of products and 2 dates columns : Start Date and End Date,
please, i need to calculate the sales from "Sales" table, only for dates that are between (>= <=) the start date and end date, and only for the products that are in the Target Table (not all products of sales table)
the result needed in image
Sofiane85
Add following culumn to your target table:Sales = VAR __Prod = Target[Product] VAR __DateStart = Target[start date] VAR __DateEnd = Target[end date] VAR __Result = SUMX( FILTER( Sales, Sales[Product] = __Prod && Sales[Date] >= __DateStart && Sales[Date] <= __DateEnd ), Sales[Qte] ) RETURN __Result
6 Replies
- FowmySuper User
Sofiane85
Add following culumn to your target table:Sales = VAR __Prod = Target[Product] VAR __DateStart = Target[start date] VAR __DateEnd = Target[end date] VAR __Result = SUMX( FILTER( Sales, Sales[Product] = __Prod && Sales[Date] >= __DateStart && Sales[Date] <= __DateEnd ), Sales[Qte] ) RETURN __Result