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,
I'm trying to convert the power BI report data resource from Import to DirectQuery (Azure SQL). This measure is used to get the latest value for each category.
Measure =
VAR LatestTime = CALCULATE(MAX(Table[Time]), FILTER(Table, Table[Category] =1))
RETURN CALCULATE(AVERAGE(Table[Value]), FILTER(Table, [Category] = 1), FILTER(Table, [Time] = LatestTime))
Solved! Go to Solution.
Hi, @irisX
You may try the following measure to see if it helps.
Measure =
VAR LatestTime =
CALCULATE (
MAX ( 'Table'[Time] ),
FILTER (
ALLSELECTED('Table'),
'Table'[Category] = 1
)
)
RETURN
CALCULATE (
AVERAGE ( 'Table'[Value] ),
FILTER (
ALLSELECTED('Table'),
'Table'[Category] = 1&&
'Table'[Time]=LatestTime
)
)
About limitation and considerations in Direct Query mode, please refer to the document .
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @irisX
You may try the following measure to see if it helps.
Measure =
VAR LatestTime =
CALCULATE (
MAX ( 'Table'[Time] ),
FILTER (
ALLSELECTED('Table'),
'Table'[Category] = 1
)
)
RETURN
CALCULATE (
AVERAGE ( 'Table'[Value] ),
FILTER (
ALLSELECTED('Table'),
'Table'[Category] = 1&&
'Table'[Time]=LatestTime
)
)
About limitation and considerations in Direct Query mode, please refer to the document .
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
VAR LatestTime = CALCULATE(MAX(Table[Time]),All(Table), Table[Category] =1)
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 |
---|---|
102 | |
53 | |
21 | |
13 | |
11 |