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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
TornDigorn
Frequent Visitor

return values for two conditions - value greater than + text ( contains or not contais)

Hello dear Community 

I need to generate  some columns for below table, which will be based on the values in the "DWELL" column and the text content of the column named "COMMENTS" 

Case 1 - Return AWB number for Case 1 column if DWELL >2 and comment contais "C-" 

Case 2 - Return AWB number for Case 2 column if DWELL >2 and comment doesn't contain "C-" 

Case 3 - Return AWB number for Case 3 column if DWELL >7  and comment contais "RTS" 

Case 4  - Return AWB number for Case 4 column if DWELL >7  and comment doesn't contain "RTS" 

 

If any additional explanation is needed I will be happy to assist 

Thank you !

 

AWB number DWELLCOMMENTSCase 1 Case 2 Case 3Case 4
59296997220111C-97145436 27.01.2023 pulling    
3936138561103C-96677635 23.01.2023    
7705892545703C-94559996 03.1.2023 PULLING    
7710820022331KRKCAGE1 pulling    
7709473214723RETOUR EN FRANCHISE    
7710567506383KRKCAGE1 pulling    
7707764956623C-93047787 19.12.2022 pulling    
3939291742984KRKCAGE1    
5407715161504KRKCAGE1    
5731852020984KRK    
54913389799710C-97266744 28.01.2023    
77087071176510C-96774332 24.01.2023 RTS    
77107796852041C-96699803 23.1.2023 RTS    
6203969443491C-97757933 02.02.2023 pulling    
77114421150050KRKCAGE1    
61147223100950KRKCAGE1    
5857444346731C-90572059 RTS    
3939008218021C-97616150 01.02.2023    
7711148316753KRKCAGE1    
39404608410015KRK    
77119428106312KRK    
7711690299341KRKCAGE1 pulling    
39410828570041     
3933487397844C-97756422 02.02.2023 pulling    
59296997220111C-97145436 27.01.2023 pulling    
3936138561104C-96677635 23.01.2023    
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @TornDigorn ,

You can create the calculated columns as below to get them:

Case 1 = 
IF (
    'Table'[DWELL] > 2
        && IFERROR ( SEARCH ( "C-", 'Table'[COMMENTS], 1, 0 ), 0 ) > 0,
    'Table'[AWB number]
)
Case 2 = 
IF (
    'Table'[DWELL] > 2
        && IFERROR ( SEARCH ( "C-", 'Table'[COMMENTS], 1, 0 ), 0 ) = 0,
    'Table'[AWB number]
)
Case 3 = 
IF (
    'Table'[DWELL] > 7
        && IFERROR ( SEARCH ( "RTS", 'Table'[COMMENTS], 1, 0 ), 0 ) > 0,
    'Table'[AWB number]
)
Case 4 = 
IF (
    'Table'[DWELL] > 7
        && IFERROR ( SEARCH ( "RTS", 'Table'[COMMENTS], 1, 0 ), 0 ) = 0,
    'Table'[AWB number]
)

yingyinr_0-1676436272535.png

Best Regards

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @TornDigorn ,

You can create the calculated columns as below to get them:

Case 1 = 
IF (
    'Table'[DWELL] > 2
        && IFERROR ( SEARCH ( "C-", 'Table'[COMMENTS], 1, 0 ), 0 ) > 0,
    'Table'[AWB number]
)
Case 2 = 
IF (
    'Table'[DWELL] > 2
        && IFERROR ( SEARCH ( "C-", 'Table'[COMMENTS], 1, 0 ), 0 ) = 0,
    'Table'[AWB number]
)
Case 3 = 
IF (
    'Table'[DWELL] > 7
        && IFERROR ( SEARCH ( "RTS", 'Table'[COMMENTS], 1, 0 ), 0 ) > 0,
    'Table'[AWB number]
)
Case 4 = 
IF (
    'Table'[DWELL] > 7
        && IFERROR ( SEARCH ( "RTS", 'Table'[COMMENTS], 1, 0 ), 0 ) = 0,
    'Table'[AWB number]
)

yingyinr_0-1676436272535.png

Best Regards

TornDigorn
Frequent Visitor

TornDigorn_0-1676376973605.png

this table is more readable

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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