The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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!
User | Count |
---|---|
11 | |
8 | |
6 | |
6 | |
6 |
User | Count |
---|---|
23 | |
14 | |
13 | |
10 | |
8 |