The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
118 | |
87 | |
75 | |
53 | |
45 |
User | Count |
---|---|
135 | |
121 | |
77 | |
65 | |
64 |