The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I need to calculate the sum of the # of invoices, but only if the Date is in the last 7 calendar days of each month. I will have YTD data, updated daily.
# invoices | Date |
7 | 6/27/2023 |
4 | 6/28/2023 |
2 | 6/29/2023 |
1 | 7/21/2023 |
2 | 7/22/2023 |
4 | 7/27/2023 |
5 | 7/28/2023 |
2 | 7/29/2023 |
3 | 7/31/2023 |
I thought about trying to create a column with "true" if it is in the last 7 days, and "false" if not. But I don't know how to write that. Anyone have ideas?
Solved! Go to Solution.
How about...
7dayEOMSum =
var selectedDate=selectedvalue(invoicesDate)
Calculate(sum(NumberOfInvoices), datediff(selectedDate, EOM(selectedDate,0),DAY)<=7)
If this post was helpful, please kudos or accept the answer as a solution.
~ Anthony Genovese
Need more PBI help? PM me for affordable, dedicated training or consultant recomendations!
I would try something like this
7daySum = Calculate(sum(NumberOfInvoices), datediff(invoicesDate,today(),DAY)<=7)
If this post was helpful, please kudos or accept the answer as a solution.
~ Anthony Genovese
Need more PBI help? PM me for affordable, dedicated training or consultant recomendations!
I think..this one gives me past 7 days, instead of the last 7 days of the calendar month. Is it possible to get the last 7 days of the calendar month?
How about...
7dayEOMSum =
var selectedDate=selectedvalue(invoicesDate)
Calculate(sum(NumberOfInvoices), datediff(selectedDate, EOM(selectedDate,0),DAY)<=7)
If this post was helpful, please kudos or accept the answer as a solution.
~ Anthony Genovese
Need more PBI help? PM me for affordable, dedicated training or consultant recomendations!
Ooooh - that made me think. I got it to work with:
User | Count |
---|---|
10 | |
9 | |
6 | |
6 | |
5 |
User | Count |
---|---|
22 | |
14 | |
14 | |
9 | |
7 |