Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
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:
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
16 | |
13 | |
12 | |
11 | |
11 |
User | Count |
---|---|
19 | |
14 | |
14 | |
11 | |
9 |