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 have three tables. I need the MAX timestamp from a column in each table.
Why does this not work?
ALL_LastRecord =
VAR var1LatestRecord = MAX(table1[timeStamp])
VAR var2LatestRecord = MAX(table2[timeStamp])
VAR var3LatestRecord = MAX(table3[timeStamp])
RETURN
MAX(var1LatestRecord, var2LatestRecord, var3LatestRecord)
How would I accomplish this in DAX?
(Without merging any tables, adding columns, etc.. I do not want to manipulate the tables to do this. Should be straightforward in DAX.)
Thank you
Solved! Go to Solution.
You need MC Aggregations: https://community.powerbi.com/t5/Quick-Measures-Gallery/Multi-Column-Aggregations-MC-Aggregations/m-...
"I like big aggregations and I cannot lie
You other PBI'ers can't deny"
Try
ALL_LastRecord =
VAR var1LatestRecord = MAX(table1[timeStamp])
VAR var2LatestRecord = MAX(table2[timeStamp])
VAR var3LatestRecord = MAX(table3[timeStamp])
RETURN
MAX(var1LatestRecord, max(var2LatestRecord, var3LatestRecord))
Try
ALL_LastRecord =
VAR var1LatestRecord = MAX(table1[timeStamp])
VAR var2LatestRecord = MAX(table2[timeStamp])
VAR var3LatestRecord = MAX(table3[timeStamp])
RETURN
MAX(var1LatestRecord, max(var2LatestRecord, var3LatestRecord))
Also, with your code, you could have done:
ALL_LastRecord =
VAR var1LatestRecord = MAX(table1[timeStamp])
VAR var2LatestRecord = MAX(table2[timeStamp])
VAR var3LatestRecord = MAX(table3[timeStamp])
RETURN
MAXX( {var1LatestRecord, var2LatestRecord, var3LatestRecord}, [Value] )
You need MC Aggregations: https://community.powerbi.com/t5/Quick-Measures-Gallery/Multi-Column-Aggregations-MC-Aggregations/m-...
"I like big aggregations and I cannot lie
You other PBI'ers can't deny"
Boom! The multiple aggregation approach worked.
ALL_LastRecord =
CONCATENATE(
"Last Updated: ",
VAR varTimestamp1 = SELECTCOLUMNS(table1,"Column",[timestamp])
VAR varTimestamp2 = SELECTCOLUMNS(table2,"Column",[timestamp])
VAR varTimestamp3 = SELECTCOLUMNS(table3,"Column",[timestamp])
VAR tmpTable = UNION(UNION(varTimestamp1,varTimestamp2),varTimestamp3)
VAR tmpValue = MAXX(tmpTable,[Column])
RETURN tmpValue
)
Bingo! So did @amitchandak 's approach! (Ended up going with this solution because less code)
ALL_LastRecord =
CONCATENATE(
"Last Updated: ",
VAR varTimestamp1 = MAX(table1[timestamp])
VAR varTimestamp2 = MAX(table2[timestamp])
VAR varTimestamp3 = MAX(table3[timestamp])
RETURN
MAX(varTimestamp1, MAX(varTimestamp2, varTimestamp3))
)
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 |
---|---|
106 | |
96 | |
79 | |
66 | |
62 |
User | Count |
---|---|
145 | |
113 | |
105 | |
85 | |
65 |