Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Good Day.
I am looking for a DAX formula that can display the first product ordered in a new column, based on the Group ID (expected results in Red😞
| Group ID | Date/Time of order | Product | Expected Result |
| 342582 | 15/11/2024 08:00 | Crisps | Crisps |
| 342582 | 15/11/2024 08:01 | Sweets | Crisps |
| 342582 | 15/11/2024 08:08 | Soft Drink | Crisps |
| 342582 | 15/11/2024 08:15 | Teabags | Crisps |
| 342583 | 15/11/2024 08:02 | Teabags | Teabags |
| 342583 | 15/11/2024 08:10 | Sweets | Teabags |
| 342583 | 15/11/2024 08:11 | Soft Drink | Teabags |
| 342583 | 15/11/2024 08:07 | Crisps | Teabags |
| 342584 | 15/11/2024 08:22 | Crisps | Sweets |
| 342584 | 15/11/2024 08:21 | Sweets | Sweets |
| 342584 | 15/11/2024 08:26 | Soft Drink | Sweets |
| 342584 | 15/11/2024 08:35 | Teabags | Sweets |
| 342585 | 15/11/2024 08:48 | Crisps | Soft Drink |
| 342585 | 15/11/2024 08:45 | Sweets | Soft Drink |
| 342585 | 15/11/2024 08:42 | Soft Drink | Soft Drink |
| 342585 | 15/11/2024 08:50 | Teabags | Soft Drink |
Thanks in advance.
Solved! Go to Solution.
Try Belwo Measure:
First Product Ordered =
VAR FirstOrderTime =
CALCULATE(
MIN('Table'[Date/Time of order]),
ALLEXCEPT('Table', 'Table'[Group ID])
)
RETURN
CALCULATE(
FIRSTNONBLANK('Table'[Product], 1),
'Table'[Date/Time of order] = FirstOrderTime,
ALLEXCEPT('Table', 'Table'[Group ID])
)
Group ID Date/Time of order Product First Product Ordered
| 342582 | 15/11/2024 08:00 | Crisps | Crisps |
| 342582 | 15/11/2024 08:01 | Sweets | Crisps |
| 342582 | 15/11/2024 08:08 | Soft Drink | Crisps |
| 342582 | 15/11/2024 08:15 | Teabags | Crisps |
| 342583 | 15/11/2024 08:02 | Teabags | Teabags |
| 342583 | 15/11/2024 08:10 | Sweets | Teabags |
| 342583 | 15/11/2024 08:11 | Soft Drink | Teabags |
| 342583 | 15/11/2024 08:07 | Crisps | Teabags |
| 342584 | 15/11/2024 08:22 | Crisps | Sweets |
| 342584 | 15/11/2024 08:21 | Sweets | Sweets |
| 342584 | 15/11/2024 08:26 | Soft Drink | Sweets |
| 342584 | 15/11/2024 08:35 | Teabags | Sweets |
| 342585 | 15/11/2024 08:48 | Crisps | Soft Drink |
| 342585 | 15/11/2024 08:45 | Sweets | Soft Drink |
| 342585 | 15/11/2024 08:42 | Soft Drink | Soft Drink |
| 342585 | 15/11/2024 08:50 | Teabags | Soft Drink |
This will display the expected results as per your requirements. Let me know if you need further clarification!
Thanks for your help, that has done the trick!
U r always welocme
Try Belwo Measure:
First Product Ordered =
VAR FirstOrderTime =
CALCULATE(
MIN('Table'[Date/Time of order]),
ALLEXCEPT('Table', 'Table'[Group ID])
)
RETURN
CALCULATE(
FIRSTNONBLANK('Table'[Product], 1),
'Table'[Date/Time of order] = FirstOrderTime,
ALLEXCEPT('Table', 'Table'[Group ID])
)
Group ID Date/Time of order Product First Product Ordered
| 342582 | 15/11/2024 08:00 | Crisps | Crisps |
| 342582 | 15/11/2024 08:01 | Sweets | Crisps |
| 342582 | 15/11/2024 08:08 | Soft Drink | Crisps |
| 342582 | 15/11/2024 08:15 | Teabags | Crisps |
| 342583 | 15/11/2024 08:02 | Teabags | Teabags |
| 342583 | 15/11/2024 08:10 | Sweets | Teabags |
| 342583 | 15/11/2024 08:11 | Soft Drink | Teabags |
| 342583 | 15/11/2024 08:07 | Crisps | Teabags |
| 342584 | 15/11/2024 08:22 | Crisps | Sweets |
| 342584 | 15/11/2024 08:21 | Sweets | Sweets |
| 342584 | 15/11/2024 08:26 | Soft Drink | Sweets |
| 342584 | 15/11/2024 08:35 | Teabags | Sweets |
| 342585 | 15/11/2024 08:48 | Crisps | Soft Drink |
| 342585 | 15/11/2024 08:45 | Sweets | Soft Drink |
| 342585 | 15/11/2024 08:42 | Soft Drink | Soft Drink |
| 342585 | 15/11/2024 08:50 | Teabags | Soft Drink |
This will display the expected results as per your requirements. Let me know if you need further clarification!
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 6 | |
| 6 | |
| 4 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 25 | |
| 21 | |
| 10 | |
| 8 | |
| 8 |