Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
Hi,
Hope you all had a great thanksgiving. I have a calender table and Orders table. I'm trying to create a measure to give the count of orders for the last 364 days, meaning, need order count from 12/18/2019 to 12/15/2020 and I don't want to consider today. My measure follows,
LateOrders = CALCULATE ( COUNT ('Table'[OrderId]), DATESINPERIOD('DimDate'[Date] , LASTDATE(DimDate[Date]), -364, DAY ))
When I use this measure, it's showing me the same count as that of what I got for date range from 12/18/2019 to 12/16/2020. Not sure how to alter the formula not to consider today for the order count. Any ideas ?
Thanks in advance.
Solved! Go to Solution.
Please try this expression
LateOrders =
VAR vToday =
TODAY ()
RETURN
CALCULATE (
COUNT ( 'Table'[OrderId] ),
FILTER (
ALL ( 'DimDate'[Date] ),
'DimDate'[Date] < vToday
&& 'DimDate'[Date] >= vToday - 365
)
)
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Please try this expression
LateOrders =
VAR vToday =
TODAY ()
RETURN
CALCULATE (
COUNT ( 'Table'[OrderId] ),
FILTER (
ALL ( 'DimDate'[Date] ),
'DimDate'[Date] < vToday
&& 'DimDate'[Date] >= vToday - 365
)
)
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
85 | |
79 | |
65 | |
52 | |
30 |
User | Count |
---|---|
115 | |
114 | |
71 | |
66 | |
39 |