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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I have a table in Power BI called all_contracts, which contains contract values over multiple years.
I need to create a dashboard that allows me to filter by a start year and retrieve all companies that had active contracts in that year. Then, I select an end year, and the dashboard should show the total contract value of these companies over the years between the selected start and end years.
How can I structure this in Power BI to ensure accurate filtering and visualization? Any suggestions or best practices?
Below is attached my pbix file with my data.
https://drive.google.com/file/d/1EMd06M1fD3v0HVn8ecCsyADXLsZGl6a_/view?usp=sharing
I can't seem to create a table with that command.
I get this error:
A single value for column 'Date' in table 'all_contracts' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.
Hey there!
Since the dataset contains contracts for multiple years, we need a year filter table.
Years = DISTINCT(YEAR(all_contracts[Date])) (This table will allow users to select a start year and end year.)
Then add two slicers using the Year table: One for Start Year. One for End Year.
Now, define a measure that ensures only contracts within the selected range are displayed using DAX:
Filtered Contracts =
VAR StartYear = SELECTEDVALUE(Years[Year])
VAR EndYear = SELECTEDVALUE(Years[Year], MAX(all_contracts[Date]))
RETURN
CALCULATE(
SUM(all_contracts[contract_value]),
FILTER(
all_contracts,
YEAR(all_contracts[Date]) >= StartYear &&
YEAR(all_contracts[Date]) <= EndYear
)
)
fianlly, add the Measure to a Table or Visualization (Use the Filtered Contracts measure in a table, card, or chart.
The measure dynamically updates based on the selected start and end years.)
Hope this helps!
😁😁
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 36 | |
| 33 | |
| 33 | |
| 29 |
| User | Count |
|---|---|
| 134 | |
| 96 | |
| 78 | |
| 67 | |
| 65 |