March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi All,
I'm trying to build a dynamic cumulative totals measure, where the date dimension is able to be sliced by the data ranges from an iterations dimension. The measure the I'm working off of is the following, which lets me slice the dates to get the correct results:
CALCULATE (
SUM ( FactTimeRegistrations[Hours] ),
FILTER ( ALLSELECTED ( DimDate[Date] ) , DimDate[Date] <= MAX ( DimDate[Date] ) )
)
However, I want to add an additional filter to be able to slice the date based off of the date range from a given iteration, but I have been unsuccessful so far.
The three tables that the meassure would be using are these:
Any help would be greatly appreciated!
Solved! Go to Solution.
HI @MAVIE
Please try
Hours RT =
VAR T1 =
FILTER ( ALLSELECTED ( DimDate[Date] ), DimDate[Date] <= MAX ( DimDate[Date] ) )
VAR StartDate =
MAXX ( FactTimeRegistrations, RELATED ( DimIterations[StartDate] ) )
VAR EndDate =
MAXX ( FactTimeRegistrations, RELATED ( DimIterations[EndDate] ) )
VAR T2 =
CALENDAR ( StartDate, EndDate )
RETURN
CALCULATE ( SUM ( FactTimeRegistrations[Hours] ), INTERSECT ( T1, T2 ) )
@MAVIE
First create realtionship as follows
Then use
Hours RT =
VAR T1 =
FILTER ( ALLSELECTED ( DimDate[Date] ), DimDate[Date] <= MAX ( DimDate[Date] ) )
VAR T2 =
CALENDAR (
RELATED ( DimIterations[StartDate] ),
RELATED ( DimIterations[EndDate] )
)
RETURN
CALCULATE ( SUM ( FactTimeRegistrations[Hours] ), INTERSECT ( T1, T2 ) )
Hi @tamerj1
I should have clarified the relationship. Iterations if connected to TimeRegistrations in this manner:
Also the chart that I'm creating looks as such, which has been sliced on the desired iteration. The issue then is that that have data point from before the iteration which should not be included in the calculation.
Hi @MAVIE
The same code above shall remain applicable. Please check and let me know which results you get. Thank you
Using that measure I get the following error
HI @MAVIE
Please try
Hours RT =
VAR T1 =
FILTER ( ALLSELECTED ( DimDate[Date] ), DimDate[Date] <= MAX ( DimDate[Date] ) )
VAR StartDate =
MAXX ( FactTimeRegistrations, RELATED ( DimIterations[StartDate] ) )
VAR EndDate =
MAXX ( FactTimeRegistrations, RELATED ( DimIterations[EndDate] ) )
VAR T2 =
CALENDAR ( StartDate, EndDate )
RETURN
CALCULATE ( SUM ( FactTimeRegistrations[Hours] ), INTERSECT ( T1, T2 ) )
Hi @tamerj1
This measure seems to work as intended. If anything else goes wrong, I'll try to share some test data with you.
Thank you very much for your help!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
23 | |
16 | |
12 | |
9 | |
7 |
User | Count |
---|---|
38 | |
32 | |
29 | |
12 | |
11 |