Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Good Day, looking for some assistance if possible with the below:
I have a PBI report which includes a slicer for clients, as well as a date range slicer (the date range slicer relates back to a date table). I would like to be able to display the valid Total Agreement Value for that client on my report (card format), depending on the date range selected on the slicer. Is there a way to do this in DAX? I expect it would need to look at dates in-between the Agreement Start Date and Agreement Finish Date, if there are multiple valid agreements it would also need to sum these up.
Thanks in advance.
Sample Data Table below:
Client | Product | Agreement Start Date | Agreement Finish Date | Active? | Agreement Value |
A | Hardware | 01/02/2022 | 31/01/2025 | Yes | £32,000 |
A | Hardware | 01/02/2019 | 31/01/2022 | No | £32,000 |
A | Software | 01/02/2023 | 31/01/2025 | Yes | £9,000 |
B | Hardware | 05/04/2024 | 04/04/2025 | Yes | £25,000 |
B | Hardware | 05/04/2023 | 04/04/2024 | No | £25,000 |
B | Software | 05/04/2024 | 04/04/2026 | Yes | £13,000 |
C | Hardware | 08/10/2023 | 07/10/2024 | No | £55,000 |
C | Hardware | 08/10/2024 | 07/10/2025 | Yes | £55,000 |
C | Software | 10/03/2023 | 09/03/2024 | No | £8,000 |
D | Hardware | 10/03/2021 | 09/03/2023 | No | £11,000 |
D | Hardware | 10/03/2023 | 09/03/2025 | Yes | £11,000 |
D | Software | 10/03/2023 | 09/03/2026 | Yes | £18,000 |
Solved! Go to Solution.
Hello @seankeatingpb
To achieve this in Power BI, we need a DAX measure that will calculate the Total Agreement Value for a selected client within the date range defined by the Agreement Start Date and Agreement Finish Date. This measure will check if an agreement falls within the selected date range, and if so, it will sum up the agreement values for valid agreements.
Here’s a step-by-step approach to create this measure in DAX:
Make sure:
Use the following DAX measure, which will dynamically calculate the total agreement value based on the selected client and date range:
Total Agreement Value =
VAR SelectedStartDate = MIN('Date'[Date])
VAR SelectedEndDate = MAX('Date'[Date])
RETURN
CALCULATE(
SUM('Agreements'[Agreement Value]),
'Agreements'[Agreement Start Date] <= SelectedEndDate,
'Agreements'[Agreement Finish Date] >= SelectedStartDate,
'Agreements'[Active?] = "Yes"
)
This should now display the Total Agreement Value dynamically based on your selected client and date range.
Let me know if this solution works for your report!
Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂
Kind Regards,
Poojara
Data Analyst | MSBI Developer | Power BI Consultant
Hello @seankeatingpb
To achieve this in Power BI, we need a DAX measure that will calculate the Total Agreement Value for a selected client within the date range defined by the Agreement Start Date and Agreement Finish Date. This measure will check if an agreement falls within the selected date range, and if so, it will sum up the agreement values for valid agreements.
Here’s a step-by-step approach to create this measure in DAX:
Make sure:
Use the following DAX measure, which will dynamically calculate the total agreement value based on the selected client and date range:
Total Agreement Value =
VAR SelectedStartDate = MIN('Date'[Date])
VAR SelectedEndDate = MAX('Date'[Date])
RETURN
CALCULATE(
SUM('Agreements'[Agreement Value]),
'Agreements'[Agreement Start Date] <= SelectedEndDate,
'Agreements'[Agreement Finish Date] >= SelectedStartDate,
'Agreements'[Active?] = "Yes"
)
This should now display the Total Agreement Value dynamically based on your selected client and date range.
Let me know if this solution works for your report!
Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂
Kind Regards,
Poojara
Data Analyst | MSBI Developer | Power BI Consultant
Thank you Poojara for your prompt response. My mistake; on my real report, the Active? column is actually in a TRUE/FALSE format rather than Yes/No. Any idea what adjustments i would need to make to the formula to accomodate this? If i change to 'Agreements'[Active?] = "True" I receive an error mesage.
Thanks again.
User | Count |
---|---|
15 | |
9 | |
8 | |
6 | |
5 |
User | Count |
---|---|
29 | |
18 | |
15 | |
7 | |
6 |