This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
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
Solved! Go to Solution.
@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
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@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
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@Fowmy thank you so much;
it works perfectely.
please one more thing if you want, how i can visualize this by "Seller" (i dont have a relationship between the 2 tables)
thank you again
@Sofiane85
The Seller column is in the Sales table, what is your question exactly?
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
exactely, the seller is in the Sales table, and i want to visualize the sales by Seller and product in the date ranges
and image for exemple
@Sofiane85
You need to specify the logic to allocate the sales against the sellers. looking at your data, there is not target defined by seller, only by product level.
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
thank you so much my friend, you helped me a lot, i adapted your measure to the sales table, and it works 👍
than you again
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 9 | |
| 6 | |
| 6 | |
| 6 | |
| 5 |