Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I had a table contained multiple customers order details with date and time. From that table I want to create a new table that contain last purchase/order of each customer with all the product details(remaining columns from source table
Thanks in Advance.
Solved! Go to Solution.
@ddpl this is an alternative solution:
New Calculated Table =
VAR _filter =
TREATAS(
ADDCOLUMNS(
VALUES('Table'[Customer ID]),
"@Last Date", CALCULATE(MAX('Table'[Date]))
),
'Table'[Customer ID], 'Table'[Date]
)
RETURN
CALCULATETABLE(
'Table',
_filter
)
@ddpl this is an alternative solution:
New Calculated Table =
VAR _filter =
TREATAS(
ADDCOLUMNS(
VALUES('Table'[Customer ID]),
"@Last Date", CALCULATE(MAX('Table'[Date]))
),
'Table'[Customer ID], 'Table'[Date]
)
RETURN
CALCULATETABLE(
'Table',
_filter
)
New Calculated Table =
SELECTCOLUMNS(
GENERATE(
SELECTCOLUMNS(
ADDCOLUMNS(
VALUES('Table'[Customer ID]),
"@Last Date", CALCULATE(MAX('Table'[Date]))
),
"@Customer ID", [Customer ID] & "",
"@Last Date", [@Last Date]
),
VAR _current_customer = [@Customer ID]
RETURN
FILTER(
'Table',
'Table'[Date] = [@Last Date]
&& 'Table'[Customer ID] = _current_customer
)
),
"Customer ID", [Customer ID],
"Date", [Date],
"Product ID", [Product ID],
"Product Color", [Product Color],
"Price", [Price]
)
User | Count |
---|---|
93 | |
85 | |
78 | |
68 | |
63 |
User | Count |
---|---|
113 | |
99 | |
96 | |
64 | |
58 |