Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi everyone, i have a table with cars code, buy date and sell date, seller, buyer and city, also a calendar table. The calendar table and the car table are linked by buy date
I have two filters in the page (year and month filter separately)
I want to calculate the stock by the month and year selected, by counting the cars that have been bought before the first day of the month/year selected and hasnt been sold OR had been sold after the same starting day of the month. Also i want to display this by seller and by city in a table to calculate the stock rotation.
How can a i calculate this ? Im using this measure but its not working
Solved! Go to Solution.
Try
Stock autos =
VAR MinDate =
MIN ( 'Calendar'[Date] )
VAR Result =
CALCULATE (
COUNTROWS ( Autos ),
'Calendar'[Date] <= MinDate,
Autos[Sell date] > MinDate
|| ISBLANK ( Autos[Sell date] )
)
RETURN
Result
You don't need to explicitly specify a filter for the buy date, the relationship with the calendar table will do that, and by specifying a filter on the date column of the calendar table that will automatically remove any filters on the calendar table from your slicers, as long as it is marked as a date table.
Try
Stock autos =
VAR MinDate =
MIN ( 'Calendar'[Date] )
VAR Result =
CALCULATE (
COUNTROWS ( Autos ),
'Calendar'[Date] <= MinDate,
Autos[Sell date] > MinDate
|| ISBLANK ( Autos[Sell date] )
)
RETURN
Result
You don't need to explicitly specify a filter for the buy date, the relationship with the calendar table will do that, and by specifying a filter on the date column of the calendar table that will automatically remove any filters on the calendar table from your slicers, as long as it is marked as a date table.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 4 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 25 | |
| 17 | |
| 8 | |
| 8 | |
| 7 |