Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
There is a very simple task, but I can't figure out how to do it.
I need to calculate how many colors of the product were sold on the last day of sale for each product.
table 1
table 2
my measure
lastColorSaleCount =
var maxdate = max(sales[date])
var filtertable =
ADDCOLUMNS(
sales,
"maxdatefilter",
CALCULATE(MAX(sales[color_id]), FILTER(sales, sales[date] = maxdate)))
return
COUNTX(filtertable,[maxdatefilter])
But I need to get
Please, I would be glad to help you in any way
Solved! Go to Solution.
Hello,
i just changed Max(color_id) to Distinct(Color_id)
and then the measure:
hello, this is very lengthy but might help:
(i used calculated column)
Hi, thanks for the help, but it only works on numeric fields. i made a simplified model, mine is much more complicated and my mistake is that i made it very simple. please help me again
Hello,
i just changed Max(color_id) to Distinct(Color_id)
and then the measure:
hello, are you trying to get which products and how many were sold on the latest date on your table? also could you explain how did you come up with the screenshot (the supposedly result) so we can help you out more?
made it with hands.
I'm looking for what colors were sold on the last dates
product 1 = color 2
product 2 = color 3
product 3 = color 2
total
color 2 - 2
color 3 - 1
Try
Sales on last day =
SUMX (
'Product',
VAR LastSaleDate =
CALCULATE ( MAX ( 'Sales'[Sale date] ) )
RETURN
CALCULATE ( COUNTROWS ( 'Sales' ), 'Sales'[Sale date] = LastSaleDate )
)
I'm sorry, I see a different result
User | Count |
---|---|
117 | |
75 | |
62 | |
50 | |
44 |
User | Count |
---|---|
174 | |
125 | |
60 | |
60 | |
57 |