Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I've reviews a couple of the posts on here that show how to calculate a value between two dates but its they are not quite what I am looking for.
I have a dates tables that represents fiscal calendar weeks; it has a start and end date specified.
I would like an additonal "Total Amount" column on this table that is a sum of the Amount field from another table between those dates.
DatesTable
StartDate | EndDate | TotalAmount |
1 May | 7 May | 150 |
8 May | 14 May | 75 |
AmountsTable
Date | Amount |
2 May | 50 |
7 May | 100 |
8 May | 25 |
10 May | 25 |
13 May | 25 |
I've tried
TotalAmount = Calculate(SUM(AmountsTable[Amount]), FILTER(AmountsTable,AmountsTable[Date] <=
but then it won't let me add the Start or End date as a filter from the DatesTable.
I am sure this is something super easy but any help greatly appreciated.
t
Solved! Go to Solution.
if you are adding it as a calculated column, it should allow you to add Start and End dates,
In case of MEASURE you can wrap them inside selectedvalue function
As a MEASURE
Total Amount = CALCULATE ( SUM ( AmountsTable[Amount] ), FILTER ( AmountsTable, AmountsTable[Date] <= SELECTEDVALUE ( DatesTable[EndDate] ) && AmountsTable[Date] >= SELECTEDVALUE ( DatesTable[StartDate] ) ) )
TotalAmount = CALCULATE ( SUM ( AmountsTable[Amount] ), FILTER ( AmountsTable, AmountsTable[Date] <= DatesTable[EndDate] && AmountsTable[Date] >= DatesTable[StartDate] ) )
if you are adding it as a calculated column, it should allow you to add Start and End dates,
In case of MEASURE you can wrap them inside selectedvalue function
As a MEASURE
Total Amount = CALCULATE ( SUM ( AmountsTable[Amount] ), FILTER ( AmountsTable, AmountsTable[Date] <= SELECTEDVALUE ( DatesTable[EndDate] ) && AmountsTable[Date] >= SELECTEDVALUE ( DatesTable[StartDate] ) ) )
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
95 | |
77 | |
69 | |
52 |
User | Count |
---|---|
146 | |
109 | |
106 | |
88 | |
61 |