Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hello,
I have a measure that calculates the last 7 days average starting from today and ranging back one week. The problem is that usually our data is about 2 weeks behind so I am looking for a way to modify the measure to find the last non blank value and then subtract the last 7 days. Please ignore last part, it just filters the type. THANKS!
Solved! Go to Solution.
Hi @Anonymous
Please try this measure. I assume that for dates that don't have values, LabResults table will have blank in Result column.
7DayAvg =
VAR _lastDate = MAXX ( FILTER ( LabResults, LabResults[Result] <> BLANK () ), LabResults[Date] )
RETURN
CALCULATE (
AVERAGE ( LabResults[Result] ),
(
FILTER (
DimDates,
DimDates[Date] <= _lastDate
&& DimDates[Date] > _lastDate - 7
)
),
CONTAINSSTRING ( LabResults[Type], "Test A" )
)
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Hi @Anonymous
Please try this measure. I assume that for dates that don't have values, LabResults table will have blank in Result column.
7DayAvg =
VAR _lastDate = MAXX ( FILTER ( LabResults, LabResults[Result] <> BLANK () ), LabResults[Date] )
RETURN
CALCULATE (
AVERAGE ( LabResults[Result] ),
(
FILTER (
DimDates,
DimDates[Date] <= _lastDate
&& DimDates[Date] > _lastDate - 7
)
),
CONTAINSSTRING ( LabResults[Type], "Test A" )
)
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 55 | |
| 35 | |
| 31 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 75 | |
| 72 | |
| 38 | |
| 35 | |
| 25 |