The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event! Join us in Stockholm, Sweden from September 24-27, 2024.
2-for-1 sale on June 20 only!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi
I am trying to work out how to get a final value based on a hierarchy/custom order (I have added a number for simplicity alpha-numeric ordering) from another column. Some records may only have one row per customer_id so they aren't an issue, but some other customer records may have multiple rows. Each of those row can have a different outcome value.
I have used the RANKX function unsuccessfully at this stage but I may be using the incorrect terminolgy here.
Here is what I would like to occur (thanks in advance!)
Customer_ID | Individual_State (NB this column is calculated) | **Expected column** Overall_State |
abc | 1. Shipped | SHIPPED |
cde | 1. Shipped | SHIPPED |
cde | 2. Paid | SHIPPED |
efg | 3. Ordered | ORDERED |
efg | 4. Checked | ORDERED |
efg | 4. Checked | ORDERED |
hij | 5. Confirmed | PAID |
hij | 2. Paid | PAID |
Solved! Go to Solution.
Hi @RYRY,
Please follow these steps:
The DAX expression for the calculated column is as follows:
Overall_State =
VAR _last_value = CALCULATE(MIN('Table'[Individual_State]),ALLEXCEPT('Table','Table'[Customer_ID]))
VAR _result = RIGHT(_last_value,LEN(_last_value)-SEARCH(".",'Table'[Individual_State]))
RETURN
UPPER(_result)
Result:
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
Hi @RYRY,
Please follow these steps:
The DAX expression for the calculated column is as follows:
Overall_State =
VAR _last_value = CALCULATE(MIN('Table'[Individual_State]),ALLEXCEPT('Table','Table'[Customer_ID]))
VAR _result = RIGHT(_last_value,LEN(_last_value)-SEARCH(".",'Table'[Individual_State]))
RETURN
UPPER(_result)
Result:
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
Awesome! So simple but I need to learn the 'ALLEXCEPT' function a bit more.
Cheers
@RYRY
First, create atable to store the Status and Sequence Order
Add the following calculated column:
Overall State =
VAR __Order =
MINX(
ADDCOLUMNS(
CALCULATETABLE( VALUES( Table02[Individual_State] ) , ALLEXCEPT( Table02 , Table02[Customer_ID] )),
"Order" , LOOKUPVALUE( OrderStatus[Order] , OrderStatus[Status], Table02[Individual_State] )
),
[Order]
)
VAR __Result = LOOKUPVALUE( OrderStatus[Status] , OrderStatus[Order], __Order )
RETURN
__Result
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
58 | |
34 | |
20 | |
19 | |
15 |
User | Count |
---|---|
44 | |
39 | |
33 | |
23 | |
23 |