Reputation: 5
I would like to calculate the first date of the project, a kind of minimum. When I use MINX, everything is fine, but when I want to count how many projects have this minimum date are in Jan-2024, it doesn't calculate correctly.
This is my data I used the following measure to get the minimum date of each project
minDate= MINX(Table 1, Table 1 [Date])
Then, I counted the project which have the minimum date "Jan-2024"
Count minDate from Jan-2024 = CALCULATE(DISTINCTCOUNT(Project), FILTER(Table 1, MONTH(minDate)=MONTH(TODAY())), FILTER(Table 1,YEAR(minDate)=YEAR(TODAY()))
Somehow I would like to get rid of Country in my measure.
Thanks :)
Upvotes: 0
Views: 18
Reputation: 12111
Try the following:
Count minDate from Jan-2024 =
var sTbl = SUMMARIZE('Table 1', 'Table 1'[Project], "minDate", [minDate])
return
CALCULATE(
DISTINCTCOUNT('Table 1'[Project]),
FILTER(
sTbl,
MONTH([minDate]) = MONTH(TODAY()) &&
YEAR([minDate]) = YEAR(TODAY())
)
)
Upvotes: 0