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,
I have a table below also with a time column. I want to create a new table whch shows for every ID the two new columns showing the first Start data/time for that ID and one for the End date/time of the last status change. I also want the table to have Order_no, Phase, Control strategy columns.
Any help greatly appreciated.
Thanks
Solved! Go to Solution.
hi @Pick
Just create a calculated table by this formula:
New Table =
SUMMARIZE (
'Table',
'Table'[ID],
'Table'[Order_No],
'Table'[Phase],
'Table'[CONTROL_STRATEGY],
"Start date", CALCULATE (
MIN ( 'Table'[Updated_At] ),
FILTER ( ALL('Table'), 'Table'[ID] = EARLIER ( 'Table'[ID] ) )
),
"End date", CALCULATE (
MAX ( 'Table'[Updated_At] ),
FILTER ( ALL('Table'), 'Table'[ID] = EARLIER ( 'Table'[ID] ) )
)
)
Regards,
Lin
hi @Pick
Just create a calculated table by this formula:
New Table =
SUMMARIZE (
'Table',
'Table'[ID],
'Table'[Order_No],
'Table'[Phase],
'Table'[CONTROL_STRATEGY],
"Start date", CALCULATE (
MIN ( 'Table'[Updated_At] ),
FILTER ( ALL('Table'), 'Table'[ID] = EARLIER ( 'Table'[ID] ) )
),
"End date", CALCULATE (
MAX ( 'Table'[Updated_At] ),
FILTER ( ALL('Table'), 'Table'[ID] = EARLIER ( 'Table'[ID] ) )
)
)
Regards,
Lin
HI,
Thanks for the reply it nearly worked.
For each ID it is returning the earliest and latest status change.
The Order_No is always unique. Within every order number there are different IDs and different orders can have the same IDs. So I need to get the earliest status and latest status for every ID within every order.
The solution provided just searched for the earliest and latest ID status change independant of order_no we need this for every ID in every order.
Thanks for your support
Ian
Hi @Pick ,
in the query editor, group your table by "ID", choose the Minx and Maxes that your need and in addition to that, add a column with the aggregation "All". That will return the original rows by ID of the table and you can "expand back" all the other columns you need.
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
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 |
---|---|
114 | |
100 | |
81 | |
70 | |
62 |
User | Count |
---|---|
148 | |
116 | |
104 | |
90 | |
65 |