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 there,
I have a matrix in Power BI that looks like this (except the yellow column):
I want to return the next transaction_id based on the begin_date_time. The yellow column is demonstrating the expected result of the measure. So the transaction with let's say ID 9 started at 8:13 AM. The next transaction in chronological order started at 8:20 AM, so ID 18.
Transactions are generated in a store and at a counter (second and third column). The matrix is filtered by three slicer: the store_id, the counter_id and the begin_date.
My current measure looks like this. I first tried to filter my transaction table to all transaction after the current one and count the rows of this table. Unfortunetally I fail trying even this:
next transaction_id =
var _begin = SELECTEDVALUE( 'transaction'[begin_date_time] )
var _result = CALCULATE( COUNTROWS( 'transaction' ), ALLSELECTED( 'transaction' ), 'Timetable'[Time] > _begin )
return _begin
I am thankfull for every advice!
Best regards
Solved! Go to Solution.
@MrFugbaum , Try a measure like
New meausre =
var _next = minx(filter(allselected(Table), Table[store_id] = max(Table[Store_id]) && Table[begin_date_time] > max(Table[begin_date_time])),[begin_date_time])
return
minx(filter(allselected(Table), Table[store_id] = max(Table[Store_id]) && Table[begin_date_time] = _next),[transaction_id ])
If you need a new column you can use it earlier in place max and remove allselected on the table
Earlier, I should have known Earlier: https://www.youtube.com/watch?v=cN8AO3_vmlY&t=17820s
@MrFugbaum , Try a measure like
New meausre =
var _next = minx(filter(allselected(Table), Table[store_id] = max(Table[Store_id]) && Table[begin_date_time] > max(Table[begin_date_time])),[begin_date_time])
return
minx(filter(allselected(Table), Table[store_id] = max(Table[Store_id]) && Table[begin_date_time] = _next),[transaction_id ])
If you need a new column you can use it earlier in place max and remove allselected on the table
Earlier, I should have known Earlier: https://www.youtube.com/watch?v=cN8AO3_vmlY&t=17820s
Works fine for me. Thank you very much!
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 |
---|---|
104 | |
101 | |
79 | |
72 | |
64 |
User | Count |
---|---|
142 | |
108 | |
101 | |
81 | |
74 |