Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! 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
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 50 | |
| 49 | |
| 35 | |
| 15 | |
| 14 |
| User | Count |
|---|---|
| 91 | |
| 75 | |
| 41 | |
| 26 | |
| 25 |