Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
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.
@Anonymous
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
@Anonymous
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!
@Anonymous my pleasure 🙂
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 50 | |
| 44 | |
| 42 | |
| 18 | |
| 18 |
| User | Count |
|---|---|
| 69 | |
| 68 | |
| 32 | |
| 32 | |
| 32 |