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.
Hello everybody,
i have the following problem.
The data model is as follows
I need to find a measure that indicates whether the Rolling Avg Sales 3 Months is out of range (fields from/to from table Models)
The Measure "Rolling Avg Sales 3 Months" is
Rolling Avg Sales 3 Months =
VAR _lastDate =
LASTDATE(DimDate[Date])
RETURN
CALCULATE(
AVERAGEX(VALUES(DimDate[Month]), [Total Sales]),
FILTER(
ALL(DimDate),
DimDate[Date] <= _lastDate &&
DimDate[Date] >= DATEADD(_lastDate,-3,MONTH)
)
)
thanks for your attention
Franco
Solved! Go to Solution.
Hi @Franco
Please use
NewMeasure =
VAR From =
CALCULATE (
SELECTEDVALUE ( Medels[From] ),
CROSSFILTER ( Models[ModelID], Items[ModelID], BOTH )
)
VAR To =
CALCULATE (
SELECTEDVALUE ( Medels[To] ),
CROSSFILTER ( Models[ModelID], Items[ModelID], BOTH )
)
VAR RollingAvg = [Rolling Avg Sales 3 Months]
RETURN
IF (
NOT ISBLANK ( RollingAvg ),
IF ( RollingAvg >= From && RollingAvg <= To, "IN RANGE", "OUT OF RANGE" )
)
Hi @Franco
please try
NewMeasure =
VAR From =
CALCULATE (
SELECTEDVALUE ( Medels[From] ),
CROSSFILTER ( Models[ModelID], Items[ModelID], BOTH )
)
VAR To =
CALCULATE (
SELECTEDVALUE ( Medels[To] ),
CROSSFILTER ( Models[ModelID], Items[ModelID], BOTH )
)
VAR RollingAvg = [Rolling Avg Sales 3 Months]
RETURN
IF ( RollingAvg >= From && RollingAvg <= To, "IN RANGE", "OUT OF RANGE" )
Hi @tamerj1 ,
thanks for the answer but if i put your measure in the table, each row is multiplied by each model
Hi @Franco
Please use
NewMeasure =
VAR From =
CALCULATE (
SELECTEDVALUE ( Medels[From] ),
CROSSFILTER ( Models[ModelID], Items[ModelID], BOTH )
)
VAR To =
CALCULATE (
SELECTEDVALUE ( Medels[To] ),
CROSSFILTER ( Models[ModelID], Items[ModelID], BOTH )
)
VAR RollingAvg = [Rolling Avg Sales 3 Months]
RETURN
IF (
NOT ISBLANK ( RollingAvg ),
IF ( RollingAvg >= From && RollingAvg <= To, "IN RANGE", "OUT OF RANGE" )
)
works great!
Thanks!!!!!
@Franco Maybe:
Measure =
VAR __From = MAX('Table'[From])
VAR __To = MAX('Table'[To])
VAR __RollingAvg = [Rolling Avg Sales 3 Months]
RETURN
IF( __RollingAvg >= __From && __RollingAvg <= __To, "IN RANGE", "OUT OF RANGE")
Thanks @Greg_Deckler
but even with your measure, the records are repeated for each model.
I only need the green lines....
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 |
---|---|
47 | |
26 | |
19 | |
14 | |
10 |
User | Count |
---|---|
58 | |
50 | |
44 | |
19 | |
19 |