Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello,
I have an inventory table with 2 columns, product_id and date.
Each product_id only has a date for the days we had it in stock.
Im trying to to count how many days we had the product in stock for the last 30 days before the date in the column, and i want this for all the past dates, ie check fro mthat date 30 days back how many entries it has.
Solved! Go to Solution.
Column =
VAR _current_product = 'Table'[product_id]
VAR _current_date = 'Table'[date]
VAR _result =
COUNTROWS(
FILTER(
'Table'
,'Table'[product_id] = _current_product
&& 'Table'[date] >= _current_date - 29
&& 'Table'[date] <= _current_date
)
)
RETURN
_result
Column =
VAR _current_product = 'Table'[product_id]
VAR _current_date = 'Table'[date]
VAR _result =
COUNTROWS(
FILTER(
'Table'
,'Table'[product_id] = _current_product
&& 'Table'[date] >= _current_date - 29
&& 'Table'[date] <= _current_date
)
)
RETURN
_result
Flawless solution, thank you so much!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
97 | |
84 | |
67 | |
59 |
User | Count |
---|---|
150 | |
120 | |
99 | |
87 | |
68 |