Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have a basic order table with many different products. I would like to generate an overview for the last orderdate per customer per product. Cannot succeed in finding the right formula. Max formula only retrieves max of one value. Should I generate a new table for this or should I do that in the orderoverview table. Risking that for every orderline again, the max value needs to be calculated.
Please advise both on the best approach and the formula to use.
CustomerID | ProductID | OrderDate |
1 | 1 | 1-1-2022 |
1 | 2 | 31-12-2021 |
1 | 3 | 25-7-2022 |
2 | 1 | 15-2-2022 |
2 | 1 | 12-7-2022 |
2 | 1 | 3-8-2022 |
3 | 1 | 3-8-2021 |
3 | 1 | 28-2-2022 |
3 | 2 | 5-7-2021 |
3 | 2 | 1-11-2021 |
3 | 2 | 1-4-2022 |
3 | 3 | 1-6-2021 |
4 | 1 | 1-7-2022 |
4 | 2 | 1-8-2022 |
4 | 3 | 1-9-2022 |
Solved! Go to Solution.
Hi,
Please check the below picture and the attached pbix file.
It is for creating a new table.
Last order date per customer and per product =
ADDCOLUMNS (
SUMMARIZE ( Data, Customer[CustomerID], 'Product'[ProductID] ),
"@maxdate", CALCULATE ( MAX ( Data[OrderDate] ) )
)
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
hi @JKVM
In addition to Jihwan's solution, if you have all the columns in one table, you may also write a table like this:
LastTable =
ADDCOLUMNS(
SUMMARIZE(
TableName,
TableName[CustomerID],
TableName[ProductID]
),
"LatestOrderDate",
CALCULATE(MAX(TableName[OrderDate]))
)
Or you can simply plot a table visual with [CustomerID] column, [ProductID] column and a measure like this:
LatestOrderDate2 = MAX(TableName[OrderDate])
hi @JKVM
In addition to Jihwan's solution, if you have all the columns in one table, you may also write a table like this:
LastTable =
ADDCOLUMNS(
SUMMARIZE(
TableName,
TableName[CustomerID],
TableName[ProductID]
),
"LatestOrderDate",
CALCULATE(MAX(TableName[OrderDate]))
)
Or you can simply plot a table visual with [CustomerID] column, [ProductID] column and a measure like this:
LatestOrderDate2 = MAX(TableName[OrderDate])
Hi,
Please check the below picture and the attached pbix file.
It is for creating a new table.
Last order date per customer and per product =
ADDCOLUMNS (
SUMMARIZE ( Data, Customer[CustomerID], 'Product'[ProductID] ),
"@maxdate", CALCULATE ( MAX ( Data[OrderDate] ) )
)
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
37 | |
25 | |
19 | |
14 | |
8 |
User | Count |
---|---|
69 | |
48 | |
44 | |
19 | |
15 |