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.
Hi all,
I'm trying to solve following issue, but can't make it.
I need to get name (table 2) but filtered by first date (not last) (table 1).
'Table1' linked to 'Table 2' through 'user_id'
This is simplified table, I applied following to get this:
table 1
order_id | user_id | action | Date | description_c.2 |
97396 | 44698 | rus_order_logs_order_changed | 02.03.2021 10:41 | |
97396 | 44698 | rus_order_logs_order_changed | 06.03.2021 11:04 | |
97396 | 50679 | rus_order_logs_order_changed | 17.03.2021 18:35 |
table 2
user_id | Name |
44698 | Patrick |
50679 | Anna |
11122 | Angela |
... | ... |
Solved! Go to Solution.
Hi, @Anonymous
I'm not quite sure what you expect the output to be, If you could provide the output you expect, the problem will be better resolved.
there I assume that it is grouped by order-ID and user-ID to return the user name of the earliest date
Try to create a measure below:
Return name =
VAR _minDate =
MINX (
FILTER (
'Table',
'Table'[order_id] = 'Table'[order_id]
&& 'Table'[user_id] = 'Table'[user_id]
),
'Table'[Date]
)
RETURN
CALCULATE (
SELECTEDVALUE ( Table2[Name] ),
FILTER (
'Table',
'Table'[order_id] = 'Table'[order_id]
&& 'Table'[user_id] = 'Table'[user_id]
&& 'Table'[Date] = _minDate
)
)
I created a simple sample to illustrate this.
Sample:
Result:
Is this close to what you want?
Please refer to the attachment below for details
Is this the result you want? Hope this is useful to you
Please feel free to let me know If you have further questions
Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Anonymous
I'm not quite sure what you expect the output to be, If you could provide the output you expect, the problem will be better resolved.
there I assume that it is grouped by order-ID and user-ID to return the user name of the earliest date
Try to create a measure below:
Return name =
VAR _minDate =
MINX (
FILTER (
'Table',
'Table'[order_id] = 'Table'[order_id]
&& 'Table'[user_id] = 'Table'[user_id]
),
'Table'[Date]
)
RETURN
CALCULATE (
SELECTEDVALUE ( Table2[Name] ),
FILTER (
'Table',
'Table'[order_id] = 'Table'[order_id]
&& 'Table'[user_id] = 'Table'[user_id]
&& 'Table'[Date] = _minDate
)
)
I created a simple sample to illustrate this.
Sample:
Result:
Is this close to what you want?
Please refer to the attachment below for details
Is this the result you want? Hope this is useful to you
Please feel free to let me know If you have further questions
Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous , Try measures like these for all column other the user_id and date
order_id =
VAR __id = MAX ('Table'[user_id] )
VAR __date = CALCULATE ( MAX('Table'[date] ), ALLSELECTED ('Table' ), 'Table'[user_id] = __id )
CALCULATE ( max ('Table'[order_id] ), VALUES ('Table'[user_id] ),'Table'[user_id] = __id,'Table'[date] = __date )
Sorry, I did not mention one thing, I made little correction, could you please check?
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 |
---|---|
113 | |
99 | |
80 | |
70 | |
59 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |