Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Saxon202202
Helper III
Helper III

Group By From-To Text without duplication

Hi,

I hava data contain following columns are type, bin, section, bay and level.

Logic1If bay hasall the level from A to E range according to the Type, Section, Bay and Level then return from-to Bay (Example: Row 34 to 161).
Logic2If bay doesn't have from A to E range according to the Type, Section, Bay and Level then return from to range bay with level (Example: Row 34 to 161).
Desired ResultCombine logic1 and logic2 into one line like this "A01D-A02D,A03-A05" according to the Type, Section, Bay and Level.
CriteriaType, Bin, Section, Bay and Level.

 

Saxon202202_0-1731260176378.png

Herewith attached the file for your reference.
https://www.dropbox.com/scl/fi/i8qi32erxkw7epg1rmuqn/FTR1.xlsx?rlkey=peyoqisp4t9ku8ut884m1yg5o&st=yb...

4 REPLIES 4
danextian
Super User
Super User

Hi @Saxon202202 

Sorry but your logic is unclear.

Given your data and the desired result, it seems that you want to group the bays by Section and then return the min and max bays as xxx-xxx. However, your sample data doesn't have any bays that have levels from A to E. In fact, there's no E at all.  How then rows 34-161 have xxx-xxx results? How are rows 1-33 different from 34-161?





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
Anonymous
Not applicable

Hi @Saxon202202 ,

 

Sorry, I don't quite understand your logical description.

From your data and what you expect, it seems that you want to group by Section, and then by Bay to see the non-recount of Levels, if it's equal to 1, it's AXXX-AXXX, otherwise it's AXX-AXX.
And also to combine them.

vstephenmsft_0-1731294364881.png

If possible, please provide more details of your problem.

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

@danextian and @Anonymous.

 

Thanks for your reply and sorry for the late reply. 

 

Given a dataset with columns such as Type, Bin, Section, Bay, and Level, you need to group the data by Section and Bay and check if all levels from A to E are present within each group. If all levels are present, you should return a single range representing the bay. If not all levels are present, you should return specific ranges for those levels. The final output should combine these results into one string.
Logic:
  1. Logic 1 (Full Range of Levels Present):
    • If a particular Bay has all levels from A to E (or whatever the full set is), return a range combining all of them, e.g., A03-A05.
  2. Logic 2 (Partial Levels Present):
    • If a particular Bay does not have all levels from A to E, identify the specific levels present and return the ranges for these levels, e.g., A01D-A02D.
Combined Result:
Combine the results from Logic 1 and Logic 2 into a single output string for each Section. For example, if a section has one complete bay and another with partial levels, the result should look like A01D-A02D, A03-A05.
Criteria:
  • Criteria for Full Range: A bay must have all levels from A to E.
  • Partial Levels: Identify any missing levels and include only the ranges that are present.
 

hi @Saxon202202 

You explanation is still unclear. You mentioned that a bay must have all levels. Bay A22 only has levels A, B and D and yet it based on the desired result, logic 2 is applied.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.